--- XFree86-3.3.6/xc/config/cf/Imake.cf.sparc Fri Jul 30 12:45:47 1999 +++ XFree86-3.3.6/xc/config/cf/Imake.cf Fri Sep 20 18:47:51 2002 @@ -592,6 +592,10 @@ # undef __ARM_ARCH_3__ # endif # endif +# if defined(__sparc__) || defined(sparc) +# define SparcArchitecture +# undef sparc +# endif #endif /* linux */ #if (defined(__Lynx__) || defined(Lynx)) && (defined(i386) || defined(__i386__) || defined(__x86__) || defined(__powerpc__) || defined(__sparc__) || defined(sparc)) --- XFree86-3.3.6/xc/config/cf/linux.cf.sparc Fri Sep 20 18:42:54 2002 +++ XFree86-3.3.6/xc/config/cf/linux.cf Fri Sep 20 18:47:55 2002 @@ -228,8 +228,11 @@ #endif #endif #if UseElfFormat -#ifndef BuildDynamicLoading -#define BuildDynamicLoading YES +#ifndef SparcArchitecture +/* Dynamic loading currently works with XFree86 only */ +# ifndef BuildDynamicLoading +# define BuildDynamicLoading YES +# endif #endif #endif #define CppCmd /lib/cpp @@ -284,6 +287,17 @@ #define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines #endif /* Arm */ +#ifdef SparcArchitecture +#define OptimizedCDebugFlags -O2 +#define LinuxMachineDefines -D__sparc__ +#define ServerOSDefines -DDDXOSINIT +#define ServerExtraDefines -DGCCUSESGAS XFree86ServerDefines +#if LinuxCLibMajorVersion <= 5 +/* Why we lack this when everybody else has it? */ +#define HasCbrt NO +#endif +#endif /* SparcArchitecture */ + #define StandardDefines -Dlinux LinuxMachineDefines LinuxSourceDefines #ifndef TermcapLibrary @@ -343,6 +357,36 @@ $(MAKE) -C dir $(MFLAGS) $(PARALLELMFLAGS) flags subname #include +#if defined(SparcArchitecture) +#ifndef Xsun24Server +#define Xsun24Server YES /* Multiple depths, Color, Mono */ +#endif +#ifndef XsunServer +#define XsunServer YES /* Color 8-bit and Mono */ +#endif +#ifndef XsunMonoServer +#define XsunMonoServer YES /* Mono only */ +#endif +#ifndef HasNdbm +#define HasNdbm YES +#endif +#ifndef DBMLibrary +#define DBMLibrary /usr/lib/libdb.a +#endif +#ifndef XnestServer +#define XnestServer YES +#endif +#ifndef XVirtualFramebufferServer +#define XVirtualFramebufferServer YES +#endif +#ifndef GzipFontCompression +#define GzipFontCompression YES +#endif +#ifndef UseRgbTxt +#define UseRgbTxt YES +#endif +#endif + #include #ifndef XtermWithI18N --- XFree86-3.3.6/xc/config/cf/site.def.sparc Fri Sep 20 18:42:53 2002 +++ XFree86-3.3.6/xc/config/cf/site.def Fri Sep 20 18:47:59 2002 @@ -34,6 +34,11 @@ #ifdef BeforeVendorCF +#if defined(SparcArchitecture) && defined(LinuxArchitecture) +#undef ForceNormalLib +#define ForceNormalLib YES +#endif + /* * Include this for easy XFree86 customisations */ @@ -130,6 +135,10 @@ #endif */ +#if defined(SparcArchitecture) && defined(LinuxArchitecture) +#define InstallXserverSetUID YES +#endif + #include #endif /* AfterVendorCF */ --- XFree86-3.3.6/xc/config/cf/xfree86.cf.sparc Sat Dec 11 17:20:09 1999 +++ XFree86-3.3.6/xc/config/cf/xfree86.cf Fri Sep 20 18:48:02 2002 @@ -179,6 +179,22 @@ #endif #endif /* + * For SPARC PCI platforms, the default is to build all X servers which + * are supported on this platform. + */ +#ifdef SparcArchitecture +#ifndef XF86Mach64Server +#define XF86Mach64Server YES +#endif +#ifndef XF86VGA16Server +#define XF86VGA16Server YES +#endif +#ifndef XF86Vga16Drivers +#define XF86Vga16Drivers generic +#endif +#endif + +/* * The following disables all X servers not already enabled above */ #ifndef XF86VGA16Server --- XFree86-3.3.6/xc/programs/Xserver/PEX5/dipex/swap/check.c.sparc Fri Jun 12 09:02:38 1998 +++ XFree86-3.3.6/xc/programs/Xserver/PEX5/dipex/swap/check.c Fri Sep 20 18:48:04 2002 @@ -132,9 +132,11 @@ pexContext *cntxtPtr; checkStdHeader *strmPtr; { +#if 0 /* HACK ALERT ON */ extern INT16 lastfp[MAXCLIENTS]; /* HACK ALERT OFF */ +#endif pexEnumTypeIndex fp; @@ -193,7 +195,9 @@ pexContext *cntxtPtr; checkStdHeader *strmPtr; { +#if 0 extern INT16 lastfp[MAXCLIENTS]; +#endif pexEnumTypeIndex fp; --- XFree86-3.3.6/xc/programs/Xserver/cfb/stipsparc.s.sparc Wed Apr 27 07:14:23 1994 +++ XFree86-3.3.6/xc/programs/Xserver/cfb/stipsparc.s Fri Sep 20 18:48:07 2002 @@ -85,7 +85,7 @@ #define ForEachBits LY4 #define NextBits LY5 -#ifdef SVR4 +#if defined(SVR4) || ( defined(linux) && defined(__ELF__) ) #ifdef TETEXT #define _cfbStippleStack cfbStippleStackTE #else --- XFree86-3.3.6/xc/programs/Xserver/cfb/stipsprc32.s.sparc Wed Apr 27 07:14:23 1994 +++ XFree86-3.3.6/xc/programs/Xserver/cfb/stipsprc32.s Fri Sep 20 18:48:14 2002 @@ -81,7 +81,7 @@ #define ForEachBits LY4 #define NextBits LY5 -#ifdef SVR4 +#if defined(SVR4) || ( defined(linux) && defined(__ELF__) ) #ifdef TETEXT #define _cfb32StippleStack cfb32StippleStackTE #else --- XFree86-3.3.6/xc/programs/Xserver/cfb/cfbrrop.h.sparc Wed Jan 8 20:32:41 1997 +++ XFree86-3.3.6/xc/programs/Xserver/cfb/cfbrrop.h Fri Sep 20 18:48:57 2002 @@ -71,8 +71,8 @@ #define RROP_DECLARE register unsigned long rrop_xor; #define RROP_SOLID(dst) (*(dst) = (rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) = (*(dst) & ~(mask)) | ((rrop_xor) & (mask))) -#define RROP_SOLID_lu(dst) stl_u(rrop_xor, dst) -#define RROP_SOLID_MASK_lu(dst,mask) stl_u((ldl_u(dst) & ~(mask)) | ((rrop_xor) & (mask)), dst) +#define RROP_SOLID_lu(dst) stq_u(rrop_xor, dst) +#define RROP_SOLID_MASK_lu(dst,mask) stq_u((ldq_u(dst) & ~(mask)) | ((rrop_xor) & (mask)), dst) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Copy) #endif /* GXcopy */ @@ -107,6 +107,8 @@ #define RROP_FETCH_GCPRIV(devPriv) rrop_xor = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) ^= (rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) ^= ((rrop_xor) & (mask))) +#define RROP_SOLID_lu(dst) stq_u(ldq_u(dst) ^ rrop_xor, dst) +#define RROP_SOLID_MASK_lu(dst,mask) stq_u(ldq_u(dst) ^ ((rrop_xor) & (mask)), dst) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,Xor) #endif /* GXxor */ @@ -261,6 +263,8 @@ rrop_xor = (devPriv)->xor; #define RROP_SOLID(dst) (*(dst) = DoRRop (*(dst), rrop_and, rrop_xor)) #define RROP_SOLID_MASK(dst,mask) (*(dst) = DoMaskRRop (*(dst), rrop_and, rrop_xor, (mask))) +#define RROP_SOLID_lu(dst) stq_u(DoRRop (ldq_u(dst), rrop_and, rrop_xor), dst) +#define RROP_SOLID_MASK_lu(dst,mask) stq_u(DoMaskRRop (ldq_u(dst), rrop_and, rrop_xor, (mask)), dst) #endif #define RROP_NAME(prefix) RROP_NAME_CAT(prefix,General) #endif /* GXset */ --- XFree86-3.3.6/xc/programs/Xserver/cfb/cfb8line.c.sparc Fri Nov 13 14:14:33 1998 +++ XFree86-3.3.6/xc/programs/Xserver/cfb/cfb8line.c Fri Sep 20 18:49:01 2002 @@ -898,7 +898,11 @@ if (x1_or_len) { maskpartialbits(y1_or_e1, x1_or_len, e) - RROP_SOLID_MASK((unsigned long *) addrp, e); +#ifdef __sparc__ + RROP_SOLID_MASK_lu((unsigned long *) addrp, e); +#else + RROP_SOLID_MASK((unsigned long *) addrp, e); +#endif } } else --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/Imakefile.sparc Sun Dec 22 03:35:34 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/Imakefile Fri Sep 20 19:13:24 2002 @@ -11,29 +11,35 @@ sunMfb.c \ sunMouse.c\ sunGX.c \ - sunKeyMap.c + sunKeyMap.c \ + sunFFB.c SRCS = $(SRCS1) kbd_mode.c constype.c #ifdef i386Architecture -OFILES = sunInit.o +OFILES = sunInit.o sunGX.o sunCfb.o sunCfb24.o #else -OFILES = sunInit.o sunInitMono.o sunInExMono.o sunInitMulti.o +OFILES = sunInit.o sunInitMono.o sunInExMono.o sunInitMulti.o sunGX.o sunCfb.o sunCfb24.o sunFFB.o #endif -OBJS = sunCfb.o \ - sunCfb24.o \ - sunCursor.o \ +#ifdef LinuxArchitecture +LINUXOBJS = linux.o stubs.o +#else +LINUXOBJS = +#endif + +OBJS = sunCursor.o \ sunFbs.o \ sunIo.o \ sunKbd.o \ sunMfb.o \ sunMouse.o \ - sunGX.o \ - sunKeyMap.o + sunKeyMap.o \ + $(LINUXOBJS) INCLUDES = -I. -I../.. -I../../mi -I../../mfb -I../../cfb -I../../cfb32 \ - -I../../include -I$(XINCLUDESRC) -I$(FONTINCSRC) + -I../../include -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(EXTINCSRC) \ + -I$(LIBSRC)/font/include LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../mfb/llib-lmfb.ln ../mi/llib-lmi.ln ../cfb/llib-lcfb.ln @@ -46,9 +52,18 @@ NormalLibraryTarget(sun,$(OBJS)) NormalLintTarget($(SRCS1)) +#ifdef LinuxArchitecture +LinkSourceFile(stubs.c,../../Xi) +#endif + +SpecialCObjectRule(sunCfb,,) +SpecialCObjectRule(sunCfb24,,) +SpecialCObjectRule(sunGX,,) +SpecialCObjectRule(sunFFB,,) + #ifndef i386Architecture sunInExMono.o: $(ICONFIGFILES) -ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,$(EXT_DEFINES) -UPEXEXT) +ObjectFromSpecialSource(sunInExMono,../../mi/miinitext,$(EXT_DEFINES) -UPEXEXT -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UGLXEXT) ObjectFromSpecialSource(sunInitMono,sunInit,-DSUNMAXDEPTH=1) ObjectFromSpecialSource(sunInitMulti,sunInit,-DSUNMAXDEPTH=32) #endif --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/Xsun.man.sparc Sun Dec 22 03:35:35 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/Xsun.man Fri Sep 20 19:13:29 2002 @@ -42,13 +42,14 @@ supports the BW2 monochrome frame buffer. .I Xsun supports the CG2, CG3, CG4, and CG6 8-bit color frame buffers in -addition to the BW2 monochrome frame buffer. On Solaris 2.5 it also -supports the TCX as an 8-bit color frame buffer. +addition to the BW2 monochrome frame buffer. On Solaris 2.5 and on Linux +it also supports the TCX as an 8-bit color frame buffer. .I Xsun24 supports the cgeight 24-bit color frame buffer in addition to the 8-bit color and monochrome frame buffers that .I Xsun -supports. +supports. On Linux it supports TCX, CG14 and Creator/Creator3D in +24-bit color mode in addition to these. .PP If specific framebuffer device files aren't specified on the command line with the \fI\-dev\fP switch or in the \fIXDEVICE\fP environment --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/constype.c.sparc Mon Dec 23 06:30:11 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/constype.c Fri Sep 20 19:13:31 2002 @@ -77,18 +77,24 @@ #include #include #else +#ifdef linux +#include +#include +#else #ifndef CSRG_BASED #include #else #include #endif #endif +#endif /* Sun doesn't see fit to update to reflect the addition * of the TCX */ #define XFBTYPE_TCX 21 -#define XFBTYPE_LASTPLUSONE 22 +#define XFBTYPE_FFB 22 +#define XFBTYPE_LASTPLUSONE 23 /* decoding as of Release 3.4 : fbio.h 1.3 87/01/09 SMI */ /* the convention for entries in this table is to translate the @@ -162,6 +168,9 @@ if (fbattr.fbtype.fb_type>=FBTYPE_LASTPLUSONE) { if (fbattr.fbtype.fb_type == XFBTYPE_TCX) { *fbname = "tcx"; + return 0; + } else if (fbattr.fbtype.fb_type == XFBTYPE_FFB) { + *fbname = "creator/ffb"; return 0; } else { *fbname = "unk"; --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/kbd_mode.c.sparc Mon Dec 23 06:30:12 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/kbd_mode.c Fri Sep 20 19:13:33 2002 @@ -53,12 +53,41 @@ #include #endif #else -#ifndef CSRG_BASED +#ifdef CSRG_BASED +#include +#include +#else +#ifndef linux #include #include #else -#include -#include +#include +/* + * Commands to the Sun-2 keyboard. + */ +#define KBD_CMD_RESET 0x01 /* Reset keyboard as if power-up */ +#define KBD_CMD_BELL 0x02 /* Turn on the bell */ +#define KBD_CMD_NOBELL 0x03 /* Turn off the bell */ +#define KBD_CMD_LED1 0x04 /* Turn on LED 1 */ +#define KBD_CMD_NOLED1 0x05 /* Turn off LED 1 */ +#define KBD_CMD_LED2 0x06 /* Turn on LED 2 */ +#define KBD_CMD_NOLED2 0x07 /* Turn off LED 2 */ + +/* + * Commands to the Type 3 keyboard. KBD_CMD_BELL & KBD_CMD_NOBELL work + * as well. + */ +#define KBD_CMD_CLICK 0x0A /* Turn on the click annunciator */ +#define KBD_CMD_NOCLICK 0x0B /* Turn off the click annunciator */ + +/* + * Commands to the Type 4 keyboard, in addition to those above. + */ +#define KBD_CMD_SETLED 0x0E /* Set keyboard LED's */ +#define KBD_CMD_GETLAYOUT 0x0F /* Request that keyboard indicate layout + */ + +#endif #endif #endif #include --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/linux.c.sparc Fri Sep 20 19:13:35 2002 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/linux.c Fri Sep 20 19:13:34 2002 @@ -0,0 +1,522 @@ +/* $Xsun: xc/programs/Xserver/hw/xc/programs/Xserver/hw/sun/linux.c,v 3.3 1995/06/24 10:29:11 dawes Exp $ */ +/* + * Copyright 1992 by Orest Zborowski + * Copyright 1993 by David Wexelblat + * Copyright 1996,1998 by Jakub Jelinek + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, 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 Orest Zborowski and David Wexelblat + * not be used in advertising or publicity pertaining to distribution of + * the software without specific, written prior permission. Orest Zborowski + * and David Wexelblat make no representations about the suitability of this + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * OREST ZBOROWSKI AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND + * FITNESS, IN NO EVENT SHALL OREST ZBOROWSKI 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: linux.c /main/4 1995/11/13 05:58:38 kaleb $ */ + +#define NEED_EVENTS +#include "sun.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static Bool KeepTty = FALSE; +static int VTnum = -1; +static int activeVT = -1; +int consoleFd = -1; +int vtno; +static Bool linuxExiting = FALSE; +Bool vtRequestsPending = FALSE; +int vtOn = -1; +Bool vtSema = TRUE; +DevicePtr linuxMouse, linuxKeyboard; +Bool NoVT = FALSE; +static int cursorOn = FALSE; +static int console_screen_idx = -1; +static PixmapPtr ppix = NULL; +static pointer sunscreen = NULL; +extern char *defaultFontPath; + +static void linuxEnterLeaveVT(Bool enter) +{ + ScreenPtr pScreen; + PixmapPtr pspix; + BoxRec pixBox; + RegionRec pixReg; + DDXPointRec pixPt; + int i; + + if (console_screen_idx < 0) return; + pScreen = screenInfo.screens[console_screen_idx]; + pspix = sunGetScreenPixmap (console_screen_idx); + if (!pspix) return; + pixBox.x1 = 0; pixBox.x2 = pScreen->width; + pixBox.y1 = 0; pixBox.y2 = pScreen->height; + pixPt.x = 0; pixPt.y = 0; + (pScreen->RegionInit)(&pixReg, &pixBox, 1); + if (enter) { + if (pspix->devPrivate.ptr != sunscreen && ppix) { + pspix->devPrivate.ptr = sunscreen; + sunDoBitBlt(&ppix->drawable, &pspix->drawable, ppix->drawable.bitsPerPixel, &pixReg, &pixPt); + } + } else { + ppix = (pScreen->CreatePixmap)(pScreen, pScreen->width, + pScreen->height, pScreen->rootDepth); + if (ppix) { + sunDoBitBlt(&pspix->drawable, &ppix->drawable, ppix->drawable.bitsPerPixel, &pixReg, &pixPt); + sunscreen = pspix->devPrivate.ptr; + pspix->devPrivate.ptr = ppix->devPrivate.ptr; + } + } +} + +void linuxSetConsoleFb (int idx) +{ + console_screen_idx = idx; +} + +static void vtRequest(int sig) +{ + vtRequestsPending = TRUE; + signal(SIGUSR1,vtRequest); +} + +static void linuxEnterLeaveDev(Bool enter) +{ + int j; + + if (enter && console_screen_idx >= 0 && sunFbs [console_screen_idx].vtchange) + (*sunFbs [console_screen_idx].vtchange) (console_screen_idx, enter); + linuxEnterLeaveVT(enter); + if (enter) { + int fd; + Firm_event evBuf[20]; + sunKbdPrivPtr kbdPriv; + DeviceIntPtr pKeyboard; + + SaveScreens(SCREEN_SAVER_FORCER,ScreenSaverReset); + EnableDevice((DeviceIntPtr)linuxMouse); + EnableDevice((DeviceIntPtr)linuxKeyboard); + pKeyboard = (DeviceIntPtr)LookupKeyboardDevice(); + kbdPriv = (sunKbdPrivPtr)(pKeyboard->public.devicePrivate); + fd = kbdPriv->fd; + read (fd, evBuf, sizeof(evBuf)); + } else { + if (console_screen_idx >= 0 && sunFbs [console_screen_idx].vtchange) + (*sunFbs [console_screen_idx].vtchange) (console_screen_idx, enter); + DisableDevice((DeviceIntPtr)linuxMouse); + DisableDevice((DeviceIntPtr)linuxKeyboard); + } + for (j = 0; j < MAXSCREENS; j++) { + if (j != console_screen_idx && sunFbs[j].fd != -1) { + int i = enter; + ioctl (sunFbs[j].fd, FBIOSVIDEO, &i); + } + } +} + +static void VTSwitch() +{ + if (NoVT) return; + vtRequestsPending = FALSE; + if (vtSema) { + if (!linuxExiting) + linuxEnterLeaveDev(FALSE); + else + ErrorF("Exiting...\n\n"); + if (ioctl(consoleFd, VT_RELDISP, 1) < 0) { + if (!linuxExiting) + linuxEnterLeaveDev(TRUE); + else + ErrorF("Exiting failed\n\n"); + } else { + CursorPtr pCursor; + sunCursorPtr pCurPriv; + + vtSema = FALSE; + if (console_screen_idx >= 0) { + pCurPriv = (&(GetScreenPrivate(screenInfo.screens[console_screen_idx])->hardwareCursor)); + if (pCurPriv && pCurPriv->has_cursor && pCurPriv->pCursor != NULL) { + pCursor = pCurPriv->pCursor; + sunDisableCursor(screenInfo.screens[console_screen_idx]); + pCurPriv->pCursor = pCursor; + } + } + vtOn = console_screen_idx; + } + } else { + sunCursorPtr pCurPriv; + + vtOn = -1; + + if (console_screen_idx >= 0) { + pCurPriv = (&(GetScreenPrivate(screenInfo.screens[console_screen_idx])->hardwareCursor)); + if (pCurPriv && pCurPriv->has_cursor && pCurPriv->pCursor != NULL) + sunRealizeCursor(screenInfo.screens[console_screen_idx], pCurPriv->pCursor); + } + if (ioctl(consoleFd, VT_RELDISP, VT_ACKACQ) < 0) { + vtOn = console_screen_idx; + return; + } + vtSema = TRUE; + if (console_screen_idx >= 0) { + sunRefreshColormap (console_screen_idx); + linuxEnterLeaveDev(TRUE); + } + } +} + +/* ARGSUSED */ +void linuxBlock(pointer blockData, OSTimePtr pTimeout, pointer pReadmask) +{ +} + +/* ARGSUSED */ +void linuxWakeup(pointer blockData, int result, pointer pReadmask) +{ + if (vtRequestsPending) VTSwitch(); +} + +static char *linuxGetPathElem(char **pnt) +{ + char *p1; + + p1 = *pnt; + *pnt = index(*pnt, ','); + if (*pnt != NULL) { + **pnt = '\0'; + *pnt += 1; + } + return(p1); +} + +#define DIR_FILE "/fonts.dir" + +/* + * linuxValidateFontPath -- + * Validates the user-specified font path. Each element that + * begins with a '/' is checked to make sure the directory exists. + * If the directory exists, the existence of a file named 'fonts.dir' + * is checked. If either check fails, an error is printed and the + * element is removed from the font path. + */ +#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type)) +static char * linuxValidateFontPath(char *path) +{ + char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem; + struct stat stat_buf; + int flag; + int dirlen; + + tmp_path = (char *)xcalloc(1,strlen(path)+1); + out_pnt = tmp_path; + path_elem = NULL; + next = path; + while (next != NULL) { + path_elem = linuxGetPathElem(&next); + if (*path_elem == '/') { + dir_elem = (char *)xcalloc(1, strlen(path_elem) + 1); + if ((p1 = strchr(path_elem, ':')) != 0) + dirlen = p1 - path_elem; + else + dirlen = strlen(path_elem); + strncpy(dir_elem, path_elem, dirlen); + dir_elem[dirlen] = '\0'; + flag = stat(dir_elem, &stat_buf); + if (flag == 0) + if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR)) + flag = -1; + if (flag != 0) { + ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem); + ErrorF(" Entry deleted from font path.\n"); + continue; + } + else { + p1 = (char *)xalloc(strlen(dir_elem)+strlen(DIR_FILE)+1); + strcpy(p1, dir_elem); + strcat(p1, DIR_FILE); + flag = stat(p1, &stat_buf); + if (flag == 0) + if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG)) + flag = -1; + xfree(p1); + if (flag != 0) { + ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n", + dir_elem); + ErrorF(" Entry deleted from font path.\n"); + ErrorF(" (Run 'mkfontdir' on \"%s\").\n", dir_elem); + continue; + } + } + xfree(dir_elem); + } + + /* + * Either an OK directory, or a font server name. So add it to + * the path. + */ + if (out_pnt != tmp_path) + *out_pnt++ = ','; + strcat(out_pnt, path_elem); + out_pnt += strlen(path_elem); + } + return(tmp_path); +} + +void OpenLinuxConsole() +{ + int i, fd; + struct vt_mode VT; + char vtname[11]; + struct vt_stat vts; + char *p; + + if (NoVT) return; + for (i = 0; i < MAXSCREENS; i++) + sunFbs [i].vtchange = 0; + if (serverGeneration == 1) + { + /* check if we're run with euid==0 */ + if (geteuid() != 0) + { + FatalError("OpenLinuxConsole: Server must be suid root\n"); + } + + RegisterBlockAndWakeupHandlers(linuxBlock, linuxWakeup, (void *)0); + /* + * setup the virtual terminal manager + */ + if (VTnum != -1) + { + vtno = VTnum; + } + else + { + if ((fd = open("/dev/console",O_WRONLY,0)) < 0) + { + FatalError( + "OpenLinuxConsole: Cannot open /dev/console (%s)\n", + strerror(errno)); + } + if ((ioctl(fd, VT_OPENQRY, &vtno) < 0) || + (vtno == -1)) + { + FatalError("OpenLinuxConsole: Cannot find a free VT\n"); + } + close(fd); + } + ErrorF("(using VT number %d)\n\n", vtno); + + sprintf(vtname,"/dev/tty%d",vtno); /* /dev/tty1-64 */ + + if (!KeepTty) + { + setpgrp(); + } + + if ((consoleFd = open(vtname, O_RDWR|O_NDELAY, 0)) < 0) + { + FatalError("OpenLinuxConsole: Cannot open %s (%s)\n", + vtname, strerror(errno)); + } + + p = xalloc(strlen(defaultFontPath)+1); + if (p) { + strcpy (p, defaultFontPath); + defaultFontPath = linuxValidateFontPath(p); + xfree(p); + } else + defaultFontPath = ""; + + if (!*defaultFontPath) + FatalError("No valid FontPath could be found\n"); + + /* change ownership of the vt */ + chown(vtname, getuid(), getgid()); + + /* + * the current VT device we're running on is not "console", we want + * to grab all consoles too + */ + chown("/dev/console", getuid(), getgid()); + chown("/dev/tty0", getuid(), getgid()); + + /* + * Linux doesn't switch to an active vt after the last close of a vt, + * so we do this ourselves by remembering which is active now. + */ + if (ioctl(consoleFd, VT_GETSTATE, &vts) == 0) + { + activeVT = vts.v_active; + } + + if (!KeepTty) + { + /* + * Detach from the controlling tty to avoid char loss + */ + if ((i = open("/dev/tty",O_RDWR)) >= 0) + { + ioctl(i, TIOCNOTTY, 0); + close(i); + } + } + + /* + * now get the VT + */ + if (ioctl(consoleFd, VT_ACTIVATE, vtno) != 0) + { + ErrorF("OpenLinuxConsole: VT_ACTIVATE failed\n"); + } + if (ioctl(consoleFd, VT_WAITACTIVE, vtno) != 0) + { + ErrorF("OpenLinuxConsole: VT_WAITACTIVE failed\n"); + } + if (ioctl(consoleFd, VT_GETMODE, &VT) < 0) + { + FatalError ("OpenLinuxConsole: VT_GETMODE failed\n"); + } + + signal(SIGUSR1, vtRequest); + + VT.mode = VT_PROCESS; + VT.relsig = SIGUSR1; + VT.acqsig = SIGUSR1; + if (ioctl(consoleFd, VT_SETMODE, &VT) < 0) + { + FatalError("OpenLinuxConsole: VT_SETMODE VT_PROCESS failed\n"); + } + } + else + { + /* serverGeneration != 1 */ + /* + * now get the VT + */ + if (ioctl(consoleFd, VT_ACTIVATE, vtno) != 0) + { + ErrorF("OpenLinuxConsole: VT_ACTIVATE failed\n"); + } + if (ioctl(consoleFd, VT_WAITACTIVE, vtno) != 0) + { + ErrorF("OpenLinuxConsole: VT_WAITACTIVE failed\n"); + } + } + return; +} + +void CloseLinuxConsole() +{ + struct vt_mode VT; + int i, j; + + if (NoVT) return; + /* + * Perform a switch back to the active VT when we were started + */ + for (j = 0; j < MAXSCREENS; j++) { + if (sunFbs[j].fd != -1) { + if (sunFbs[j].origcmap.count == 16) { + ioctl(sunFbs[j].fd, FBIOPUTCMAP, &sunFbs[j].origcmap); + } + for (i = 0; i < 8; i++) + if (sunFbs[j].sizes[i]) { + munmap(sunFbs[j].maps[i], sunFbs[j].sizes[i]); + sunFbs[j].sizes[i] = 0; + } + close(sunFbs[j].fd); + } + } + if (ioctl(consoleFd, VT_GETMODE, &VT) != -1) + { + VT.mode = VT_AUTO; + if (ioctl(consoleFd, VT_SETMODE, &VT) < 0) { /* set dflt vt handling */ + ErrorF("OpenLinuxConsole: VT_SETMODE failed\n"); + } + } + linuxExiting = TRUE; + if (activeVT >= 0) + { + if (ioctl(consoleFd, VT_ACTIVATE, activeVT) < 0) { + ErrorF("OpenLinuxConsole: VT_ACTIVATE failed\n"); + } + if (ioctl(consoleFd, VT_WAITACTIVE, activeVT) < 0) { + ErrorF("OpenLinuxConsole: VT_WAITACTIVE failed\n"); + } + activeVT = -1; + } + close(consoleFd); /* make the vt-manager happy */ + return; +} + +int linuxProcessArgument (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], "-novt")) + { + NoVT = TRUE; + return 1; + } + 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; + } + return 0; +} + +#ifdef DPMSExtension +/* + * DPMSSet -- + * Device dependent DPMS mode setting hook. This is called whenever + * the DPMS mode is to be changed. + */ +void +DPMSSet(CARD16 level) +{ +} + +/* + * DPMSSupported -- + * Return TRUE if any screen supports DPMS. + */ +Bool +DPMSSupported(void) +{ + return FALSE; +} +#endif /* DPMSExtension */ + --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sun.h.sparc Mon Dec 23 06:30:13 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sun.h Fri Sep 20 19:13:36 2002 @@ -34,7 +34,17 @@ /* system headers common to both SunOS and Solaris */ #include #include + +#ifdef linux +#ifdef __GLIBC__ +#include +#else +#include +#endif +#else #include +#endif + #include #include @@ -52,7 +62,7 @@ #include -#ifndef __bsdi_ +#if !defined(__bsdi_) && !defined(linux) # ifndef CSRG_BASED # ifndef i386 # include @@ -72,7 +82,8 @@ #endif /* - * Sun specific headers Sun moved in Solaris, and are different for NetBSD. + * Sun specific headers Sun moved in Solaris, and are different for NetBSD + * and Linux. * * Even if only needed by one source file, I have put them here * to simplify finding them... @@ -88,17 +99,49 @@ # define usleep(usec) poll((struct pollfd *) 0, (size_t) 0, usec / 1000) #else # ifndef CSRG_BASED -# include -# include -# include -# include -# include -# include -# include +# ifdef linux +# define KB_KLUNK 0x00 /* Micro Switch 103SD32-2 */ +# define KB_VT100 0x01 /* Keytronics VT100 compatible */ +# define KB_SUN2 0x02 /* Sun-2 custom keyboard */ +# define KB_SUN3 0x03 /* Type 3 Sun keyboard */ +# define KB_SUN4 0x04 /* Type 4 Sun keyboard */ +# define KB_VT220 0x81 /* Emulation vt220 */ +# define KB_VT220I 0x82 /* International vt220 Emulation */ +# define KB_ASCII 0x0F /* Ascii terminal masquerading as kbd */ +# define KBD_CMD_RESET 0x01 /* Reset keyboard as if power-up */ +# define KBD_CMD_BELL 0x02 /* Turn on the bell */ +# define KBD_CMD_NOBELL 0x03 /* Turn off the bell */ +# define KBD_CMD_LED1 0x04 /* Turn on LED 1 */ +# define KBD_CMD_NOLED1 0x05 /* Turn off LED 1 */ +# define KBD_CMD_LED2 0x06 /* Turn on LED 2 */ +# define KBD_CMD_NOLED2 0x07 /* Turn off LED 2 */ +# define KBD_CMD_CLICK 0x0A /* Turn on the click annunciator */ +# define KBD_CMD_NOCLICK 0x0B /* Turn off the click annunciator */ +# define KBD_CMD_SETLED 0x0E /* Set keyboard LED's */ +# define KBD_CMD_GETLAYOUT 0x0F /* Request that keyboard indicate layout */ +# define LED_NUM_LOCK 0x1 +# define LED_COMPOSE 0x2 +# define LED_SCROLL_LOCK 0x4 +# define LED_CAPS_LOCK 0x8 +# include +# include +# include +# include +# include +# include +# else +# include +# include +# include +# include +# include +# include +# include extern int ioctl(); extern int getrlimit(); extern int setrlimit(); extern int getpagesize(); +# endif # else # ifdef CSRG_BASED # include @@ -119,10 +162,16 @@ * Sun doesn't see fit to add the TCX to */ #ifndef SVR4 +#ifndef linux /* On SunOS 4.1.x the TCX pretends to be a CG3 */ #define XFBTYPE_LASTPLUSONE FBTYPE_LASTPLUSONE #else #define XFBTYPE_TCX 21 +#define XFBTYPE_FFB 22 +#define XFBTYPE_LASTPLUSONE 23 +#endif +#else +#define XFBTYPE_TCX 21 #define XFBTYPE_LASTPLUSONE 22 #endif @@ -182,6 +231,7 @@ # define BWTWO3DEV "/dev/fbs/bwtwo3" # define CGEIGHT0DEV "/dev/fbs/cgeight0" # define TCX0DEV "/dev/fbs/tcx0" +# define FFB0DEV "/dev/fbs/ffb0" #else # define CGTWO0DEV "/dev/cgtwo0" # define CGTWO1DEV "/dev/cgtwo1" @@ -201,6 +251,9 @@ # define BWTWO2DEV "/dev/bwtwo2" # define BWTWO3DEV "/dev/bwtwo3" # define CGEIGHT0DEV "/dev/cgeight0" +# define TCX0DEV "/dev/tcx0" +# define MDI0DEV "/dev/cgfourteen0" +# define FFB0DEV "/dev/creator0" #endif /* @@ -249,6 +302,7 @@ void (*UpdateColormap)(); sunCursorRec hardwareCursor; Bool hasHardwareCursor; + WindowExposuresProcPtr WindowExposures; } sunScreenRec, *sunScreenPtr; #define GetScreenPrivate(s) ((sunScreenPtr) ((s)->devPrivates[sunScreenIndex].ptr)) @@ -260,6 +314,20 @@ struct fbtype info; /* Frame buffer characteristics */ void (*EnterLeave)();/* screen switch */ unsigned char* fbPriv; /* fbattr stuff, for the real type */ + void * private; +#ifdef linux + struct fbcmap origcmap; + void (*vtchange)( +#if NeedFunctionPrototypes + int /* screen */, + int /* enter */ +#endif + ); + int cursor_type; + void * cursor_regs; + unsigned long maps[8]; + unsigned long sizes[8]; +#endif } fbFd; typedef Bool (*sunFbInitProc)( @@ -276,6 +344,12 @@ char* name; /* /usr/include/fbio names */ } sunFbDataRec; +#ifdef linux +extern int vtOn; +#else +#define vtOn -1 +#endif + #ifdef XKB extern Bool noXkbExtension; #endif @@ -318,9 +392,13 @@ #if defined(SVR4) || defined(CSRG_BASED) void #else +#ifdef linux + int /* status */, void * /* arg */ +#else char* /* arg */ #endif #endif +#endif ); extern void sunEnqueueEvents( @@ -336,6 +414,13 @@ #endif ); +extern int sunFFBAccelInit( +#if NeedFunctionPrototypes + ScreenPtr /* pScreen */, + fbFd* /* fb */ +#endif +); + extern Bool sunSaveScreen( #if NeedFunctionPrototypes ScreenPtr /* pScreen */, @@ -353,7 +438,7 @@ #if NeedFunctionPrototypes size_t /* len */, off_t /* off */, - int /* fd */ + int /* scr */ #endif ); @@ -491,5 +576,37 @@ Colormap* /* pCmapList */ #endif ); + +#ifdef linux + +extern void sunDoBitBlt( +#if NeedFunctionPrototypes + DrawablePtr /* ppix */, + DrawablePtr /* pspix */, + int /* bpp */, + RegionPtr /* pixReg */, + DDXPointPtr /* pixPt */ +#endif +); + +extern void sunRefreshColormap( +#if NeedFunctionPrototypes + int /* idx */ +#endif +); + +extern PixmapPtr sunGetScreenPixmap( +#if NeedFunctionPrototypes + int /* screen */ +#endif +); + +extern void linuxSetConsoleFb( +#if NeedFunctionPrototypes + int /* idx */ +#endif +); + +#endif #endif --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunCfb.c.sparc Mon Feb 16 00:40:55 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunCfb.c Fri Sep 20 19:13:39 2002 @@ -98,6 +98,7 @@ { struct fbcmap sunCmap; + if (!vtOn) return; sunCmap.index = dex; sunCmap.count = count; sunCmap.red = &rmap[dex]; @@ -221,7 +222,6 @@ static void CGScreenInit (pScreen) ScreenPtr pScreen; { -#ifndef STATIC_COLOR /* { */ SetupScreen (pScreen); pScreen->InstallColormap = sunInstallColormap; pScreen->UninstallColormap = sunUninstallColormap; @@ -233,7 +233,6 @@ pScreen->whitePixel = pScreen->blackPixel; pScreen->blackPixel = pixel; } -#endif /* } */ } static void checkMono (argc, argv) @@ -244,7 +243,7 @@ for (i = 1; i < argc; i++) if (strcmp (argv[i], "-mono") == 0) - ErrorF ("-mono not appropriate for CG3/CG4/CG6\n"); + ErrorF ("-mono not appropriate for CG3/CG4/CG6/TCX/FFB/CG14\n"); } /* @@ -270,21 +269,36 @@ cfbCreateDefColormap, sunSaveScreen, 0); } -Bool sunTCXInit (screen, pScreen, argc, argv) +#define TCX_MMAP_CURSOR_OFFSET 0x70004000 +Bool sunTCX8Init (screen, pScreen, argc, argv) int screen; /* what screen am I going to be */ ScreenPtr pScreen; /* The Screen to initialize */ int argc; /* The number of the Server's arguments. */ char **argv; /* The arguments themselves. Don't change! */ { + Bool ret; + struct fbcurpos maxsize; + char *p; + checkMono (argc, argv); sunFbs[screen].EnterLeave = (void (*)())NoopDDA; - return sunInitCommon (screen, pScreen, (off_t) 0, + ret = sunInitCommon (screen, pScreen, (off_t) 0, sunCfbScreenInit, CGScreenInit, cfbCreateDefColormap, sunSaveScreen, 0); +#ifdef linux + if ((ioctl (sunFbs[screen].fd, FBIOGCURMAX, &maxsize) != -1) && + ((p = sunMemoryMap (4096, (off_t) TCX_MMAP_CURSOR_OFFSET, + screen)) != NULL)) { + sunFbs[screen].cursor_type = FBTYPE_SUNFAST_COLOR; /* thc is same as on cg6 */ + sunFbs[screen].cursor_regs = ((char *)p) + 0x8fc; + } +#endif + return ret; } #if !defined(i386) && !defined(__bsdi__) /* { */ +#ifndef linux /* { */ #ifdef SVR4 /* { */ #include #else @@ -417,10 +431,13 @@ cfbCreateDefColormap, sunSaveScreen, (int) ((CG4Ptr) 0)->cpixel); } +#endif /* } !linux */ + #ifdef FBTYPE_SUNFAST_COLOR /* { */ #define CG6_MMAP_OFFSET 0x70000000 #define CG6_IMAGE_OFFSET 0x16000 +#define CG6_CURSOR_OFFSET 0x58fc Bool sunCG6Init (screen, pScreen, argc, argv) int screen; /* The index of pScreen in the ScreenInfo */ @@ -439,12 +456,16 @@ sunFbs[screen].info.fb_height + CG6_IMAGE_OFFSET if ((fb = sunMemoryMap (FBSIZE, (off_t) CG6_MMAP_OFFSET, - sunFbs[screen].fd)) == NULL) + screen)) == NULL) return FALSE; sunFbs[screen].fb = fb; #undef FBSIZE } sunFbs[screen].EnterLeave = (void (*)())NoopDDA; +#ifdef linux + sunFbs[screen].cursor_type = FBTYPE_SUNFAST_COLOR; + sunFbs[screen].cursor_regs = sunFbs[screen].fb + CG6_CURSOR_OFFSET; +#endif if (!sunCfbSetupScreen (pScreen, sunFbs[screen].fb + CG6_IMAGE_OFFSET, sunFbs[screen].info.fb_width, --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunCfb24.c.sparc Wed Apr 27 07:14:49 1994 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunCfb24.c Fri Sep 20 19:13:50 2002 @@ -26,6 +26,12 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. +TCX and FFB/Creator support +Copyright (C) 1996,1997 Jakub Jelinek + +CG14/mdi support +Copyright (C) 1996 Miguel de Icaza + */ /* @@ -104,16 +110,13 @@ static void CG24ScreenInit (pScreen) ScreenPtr pScreen; { -#ifndef STATIC_COLOR SetupScreen (pScreen); -#endif int i; /* Make sure the overlay plane is disabled */ for (i = 0; i < CG8_COLOR_OFFSET; i++) sunFbs[pScreen->myNum].fb[i] = 0; -#ifndef STATIC_COLOR pScreen->InstallColormap = sunInstallColormap; pScreen->UninstallColormap = sunUninstallColormap; pScreen->ListInstalledColormaps = sunListInstalledColormaps; @@ -124,7 +127,6 @@ pScreen->whitePixel = pScreen->blackPixel; pScreen->blackPixel = pixel; } -#endif } Bool sunCG8Init (screen, pScreen, argc, argv) @@ -137,5 +139,334 @@ return sunInitCommon (screen, pScreen, (off_t) 0, cfb32ScreenInit, CG24ScreenInit, cfbCreateDefColormap, sunSaveScreen, CG8_COLOR_OFFSET); +} + +#define TCX_MMAP_RAM_OFFSET 0x01000000 +#define TCX_MMAP_CURSOR_OFFSET 0x70004000 +#define TCX_MMAP_CONTROL_OFFSET 0x28000000 + +#define TCX_CPLANE_MODE 0x3000000 + +static void sunTCX24UpdateColormap(pScreen, index, count, rmap, gmap, bmap) + ScreenPtr pScreen; + int index, count; + u_char *rmap, *gmap, *bmap; +{ +} + +static void sunTCX24StoreColors (pmap, ndef, pdefs) + ColormapPtr pmap; + int ndef; + xColorItem* pdefs; +{ +} + +static void sunTCX24ScreenInit (pScreen) + ScreenPtr pScreen; +{ + SetupScreen (pScreen); + + pScreen->InstallColormap = sunInstallColormap; + pScreen->UninstallColormap = sunUninstallColormap; + pScreen->ListInstalledColormaps = sunListInstalledColormaps; + pScreen->StoreColors = sunTCX24StoreColors; + pPrivate->UpdateColormap = sunTCX24UpdateColormap; + if (sunFlipPixels) { + Pixel pixel = pScreen->whitePixel; + pScreen->whitePixel = pScreen->blackPixel; + pScreen->blackPixel = pixel; + } +} + +#ifdef linux +static void tcx_vtchange (screen, enter) + int screen; + int enter; +{ + unsigned *p, *q; + + memset (sunFbs[screen].fb, 0, sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height * 4); + if (enter) + for (p = sunFbs[screen].private, q = p + sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height; p < q; p++) + *p = (*p & 0xffffff) | TCX_CPLANE_MODE; +} +#endif + +Bool sunTCX24Init (screen, pScreen, argc, argv) + int screen; /* what screen am I going to be */ + ScreenPtr pScreen; /* The Screen to initialize */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ +{ + pointer fb; + unsigned *p, *q; + + if (!sunScreenAllocate (pScreen)) + return FALSE; + if (!sunFbs[screen].fb) { +#define FBSIZE (size_t) sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height * 4 + if ((fb = sunMemoryMap (FBSIZE, + (off_t) TCX_MMAP_RAM_OFFSET, + screen)) == NULL) { + return FALSE; + } + sunFbs[screen].fb = fb; +#ifdef linux + if ((p = sunMemoryMap (4096, + (off_t) TCX_MMAP_CURSOR_OFFSET, + screen)) != NULL) { + sunFbs[screen].cursor_type = FBTYPE_SUNFAST_COLOR; /* thc is same as on cg6 */ + sunFbs[screen].cursor_regs = ((char *)p) + 0x8fc; + } +#endif + if ((p = sunMemoryMap (FBSIZE, + (off_t) TCX_MMAP_CONTROL_OFFSET, + screen)) == NULL) { + return FALSE; + } +#ifdef linux + sunFbs[screen].vtchange = tcx_vtchange; + sunFbs[screen].private = (void *)p; +#endif + memset (fb, 0, FBSIZE); + for (q = p + (FBSIZE / 4); p < q; p++) + *p = (*p & 0xffffff) | TCX_CPLANE_MODE; +#undef FBSIZE + } + sunFbs[screen].EnterLeave = (void (*)())NoopDDA; + if (!cfb32SetupScreen (pScreen, + sunFbs[screen].fb, + sunFbs[screen].info.fb_width, + sunFbs[screen].info.fb_height, + monitorResolution, monitorResolution, + sunFbs[screen].info.fb_width)) + return FALSE; + if (!cfbSetVisualTypes (24, 1 << TrueColor, 8)) + return FALSE; + if (!cfb32FinishScreenInit (pScreen, + sunFbs[screen].fb, + sunFbs[screen].info.fb_width, + sunFbs[screen].info.fb_height, + monitorResolution, monitorResolution, + sunFbs[screen].info.fb_width)) + return FALSE; + sunTCX24ScreenInit (pScreen); + if (!sunScreenInit (pScreen)) { + return FALSE; + } + sunSaveScreen (pScreen, SCREEN_SAVER_OFF); + return cfbCreateDefColormap(pScreen); +} + +static void sunCG14UpdateColormap(pScreen, index, count, rmap, gmap, bmap) + ScreenPtr pScreen; + int index, count; + u_char *rmap, *gmap, *bmap; +{ +} + +static void sunCG14StoreColors (pmap, ndef, pdefs) + ColormapPtr pmap; + int ndef; + xColorItem* pdefs; +{ +} + +static void sunCG14ScreenInit (pScreen) + ScreenPtr pScreen; +{ + SetupScreen (pScreen); + + pScreen->InstallColormap = sunInstallColormap; + pScreen->UninstallColormap = sunUninstallColormap; + pScreen->ListInstalledColormaps = sunListInstalledColormaps; + pScreen->StoreColors = sunCG14StoreColors; + pPrivate->UpdateColormap = sunCG14UpdateColormap; + if (sunFlipPixels) { + Pixel pixel = pScreen->whitePixel; + pScreen->whitePixel = pScreen->blackPixel; + pScreen->blackPixel = pixel; + } +} + +#ifdef linux +static void cg14_vtchange (screen, enter) + int screen; + int enter; +{ + int mode; + + if (enter) + mode = 32; + else + mode = 8; + ioctl (sunFbs [screen].fd, MDI_SET_PIXELMODE, &mode); +} +#endif + +#define CG14_XLUT 0x3000 + +Bool sunCG14Init (screen, pScreen, argc, argv) + int screen; /* what screen am I going to be */ + ScreenPtr pScreen; /* The Screen to initialize */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ +{ + pointer fb; + unsigned *p, *q; + char *control; + char *clut; + + if (!sunScreenAllocate (pScreen)) + return FALSE; + if (!sunFbs[screen].fb) { +#define FBSIZE (size_t) sunFbs[screen].info.fb_width * sunFbs[screen].info.fb_height * 4 + if ((fb = sunMemoryMap (FBSIZE, + (off_t) MDI_CHUNKY_BGR_MAP, + screen)) == NULL) { + return FALSE; + } + { + int bpp_32 = 32; + ioctl (sunFbs [screen].fd, MDI_SET_PIXELMODE, &bpp_32); + } + sunFbs[screen].fb = fb; + if ((p = sunMemoryMap (FBSIZE, + (off_t) MDI_PLANAR_X32_MAP, + screen)) == NULL) { + return FALSE; + } + if ((clut = sunMemoryMap (4096, (off_t) CG14_XLUT, screen)) == NULL){ + return FALSE; + } +#ifdef linux + sunFbs[screen].vtchange = cg14_vtchange; + sunFbs[screen].private = (void *)p; +#endif + memset (fb, 0, FBSIZE); + /* Clear the X channel and the Xlut */ + memset (p, 0, FBSIZE / 4); + memset (clut, 0, 0x200); + +#undef FBSIZE + } + sunFbs[screen].EnterLeave = (void (*)())NoopDDA; + if (!cfb32SetupScreen (pScreen, + sunFbs[screen].fb, + sunFbs[screen].info.fb_width, + sunFbs[screen].info.fb_height, + monitorResolution, monitorResolution, + sunFbs[screen].info.fb_width)) + return FALSE; + if (!cfbSetVisualTypes (24, 1 << TrueColor, 8)) + return FALSE; + if (!cfb32FinishScreenInit (pScreen, + sunFbs[screen].fb, + sunFbs[screen].info.fb_width, + sunFbs[screen].info.fb_height, + monitorResolution, monitorResolution, + sunFbs[screen].info.fb_width)) + return FALSE; + sunCG14ScreenInit (pScreen); + if (!sunScreenInit (pScreen)) { + return FALSE; + } + sunSaveScreen (pScreen, SCREEN_SAVER_OFF); + return cfbCreateDefColormap(pScreen); +} + +#define FFB_MMAP_RAM_OFFSET 0x05004000 +#define FFB_MMAP_CURSOR_OFFSET 0x0bc06000 +#define FFB_MMAP_CONTROL_OFFSET 0x04000000 + +static void sunFFBUpdateColormap(pScreen, index, count, rmap, gmap, bmap) + ScreenPtr pScreen; + int index, count; + u_char *rmap, *gmap, *bmap; +{ +} + +static void sunFFBStoreColors (pmap, ndef, pdefs) + ColormapPtr pmap; + int ndef; + xColorItem* pdefs; +{ +} + +static void sunFFBScreenInit (pScreen) + ScreenPtr pScreen; +{ + SetupScreen (pScreen); + + pScreen->InstallColormap = sunInstallColormap; + pScreen->UninstallColormap = sunUninstallColormap; + pScreen->ListInstalledColormaps = sunListInstalledColormaps; + pScreen->StoreColors = sunFFBStoreColors; + pPrivate->UpdateColormap = sunFFBUpdateColormap; + if (sunFlipPixels) { + Pixel pixel = pScreen->whitePixel; + pScreen->whitePixel = pScreen->blackPixel; + pScreen->blackPixel = pixel; + } +} + +Bool sunFFBInit (screen, pScreen, argc, argv) + int screen; /* what screen am I going to be */ + ScreenPtr pScreen; /* The Screen to initialize */ + int argc; /* The number of the Server's arguments. */ + char **argv; /* The arguments themselves. Don't change! */ +{ + pointer fb; + unsigned *p, *q; + + if (!sunScreenAllocate (pScreen)) + return FALSE; + if (!sunFbs[screen].fb) { + if ((fb = sunMemoryMap (0x1000000, + (off_t) FFB_MMAP_RAM_OFFSET, + screen)) == NULL) { + return FALSE; + } + sunFbs[screen].fb = fb; +#ifdef linux + if ((p = sunMemoryMap (8192, + (off_t) FFB_MMAP_CURSOR_OFFSET, + screen)) != NULL) { + sunFbs[screen].cursor_type = XFBTYPE_FFB; + sunFbs[screen].cursor_regs = ((char *)p) + 0x8; + } +#endif + if ((p = sunMemoryMap (8192, + (off_t) FFB_MMAP_CONTROL_OFFSET, + screen)) == NULL) { + return FALSE; + } + sunFbs[screen].private = (void *)p; + } + sunFbs[screen].EnterLeave = (void (*)())NoopDDA; + if (!cfb32SetupScreen (pScreen, + sunFbs[screen].fb, + sunFbs[screen].info.fb_width, + sunFbs[screen].info.fb_height, + monitorResolution, monitorResolution, + /* sunFbs[screen].info.fb_width */ 2048)) + return FALSE; + if (!cfbSetVisualTypes (24, 1 << TrueColor, 8)) + return FALSE; + if (!sunFFBAccelInit (pScreen, &sunFbs[screen])) + return FALSE; + if (!cfb32FinishScreenInit (pScreen, + sunFbs[screen].fb, + sunFbs[screen].info.fb_width, + sunFbs[screen].info.fb_height, + monitorResolution, monitorResolution, + /* sunFbs[screen].info.fb_width */ 2048)) + return FALSE; + sunFFBScreenInit (pScreen); + if (!sunScreenInit (pScreen)) { + return FALSE; + } + sunSaveScreen (pScreen, SCREEN_SAVER_OFF); + return cfbCreateDefColormap(pScreen); } --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunCursor.c.sparc Sun Sep 29 12:47:11 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunCursor.c Fri Sep 20 19:13:54 2002 @@ -47,7 +47,7 @@ static void sunLoadCursor(); -static Bool +Bool sunRealizeCursor (pScreen, pCursor) ScreenPtr pScreen; CursorPtr pCursor; @@ -55,6 +55,7 @@ SetupCursor(pScreen); int x, y; + if (!vtOn) return TRUE; /* miRecolorCursor does this */ if (pCurPriv->pCursor == pCursor) { @@ -120,6 +121,7 @@ DDXPointRec ptSrc; unsigned char source_temp[1024], mask_temp[1024]; + if (!vtOn) return; fbcursor.set = FB_CUR_SETALL; fbcursor.enable = 1; fbcursor.pos.x = x; @@ -187,6 +189,39 @@ SetupCursor(pScreen); struct fbcurpos pos; +#ifdef linux + if (!vtOn) return; + /* Ugly hack to save some syscalls when we can do it easily in userland - + * moving mouse pointer happens pretty often while using X */ + switch (sunFbs[pScreen->myNum].cursor_type) { + case FBTYPE_SUNFAST_COLOR: + *(volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs = + ((x - pCurPriv->pCursor->bits->xhot) << 16) | + ((y - pCurPriv->pCursor->bits->yhot) & 0xffff); + return; + case FBTYPE_MDICOLOR: + *(volatile unsigned char *)sunFbs[pScreen->myNum].cursor_regs |= 4; + *(((volatile unsigned short *)sunFbs[pScreen->myNum].cursor_regs)+2) = + ((x - pCurPriv->pCursor->bits->xhot) & 0xfff); + *(((volatile unsigned short *)sunFbs[pScreen->myNum].cursor_regs)+3) = + ((y - pCurPriv->pCursor->bits->yhot) & 0xfff); + return; + case FBTYPE_SUNLEO: + *(volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs &= ~0x80; + *(((volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs)+1) = + ((x - pCurPriv->pCursor->bits->xhot) & 0x7ff) | + (((y - pCurPriv->pCursor->bits->yhot) & 0x7ff) << 11); + *(volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs |= 0x30; + *(volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs |= 0x80; + return; + case XFBTYPE_FFB: + *(volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs = 0x104; + *(((volatile unsigned int *)sunFbs[pScreen->myNum].cursor_regs)+1) = + (((y - pCurPriv->pCursor->bits->yhot) & 0xffff) << 16) | + ((x - pCurPriv->pCursor->bits->xhot) & 0xffff); + return; + } +#endif pos.x = x; pos.y = y; #ifndef Lynx @@ -279,6 +314,7 @@ SetupCursor (pScreen); struct fbcursor fbcursor; + if (!vtOn) return; if (pCurPriv->has_cursor) { fbcursor.set = FB_CUR_SETCUR; --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunFbs.c.sparc Wed Jan 3 07:08:59 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunFbs.c Fri Sep 20 19:13:59 2002 @@ -79,22 +79,280 @@ static unsigned long generation = 0; +/****************************************************************/ +/* Drawing a banner at start up time */ +/****************************************************************/ + +#include +#include +#include + +#define LOGO_PATH "/etc/X11/banner/XBanner%c.ras" + +/* Sun Rasterfile definitions */ +typedef struct rasterfile { + int ras_magic; + int ras_width; + int ras_height; + int ras_depth; + int ras_length; + int ras_type; + int ras_maptype; + int ras_maplength; +} RASHDR; + +#define RT_STANDARD 1 +#define RMT_NONE 0 +#define RMT_EQUAL_RGB 1 +#define RMT_RAW 2 +#define RAS_MAGIC 0x59a66a95 + +static void clearLogoWindowExposures(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOtherRegion) +{ + SetupScreen(pWin->drawable.pScreen); + + if (!pWin->parent) { + RegionPtr expose = (*pWin->drawable.pScreen->RegionCreate)(NULL, 0); + (*pWin->drawable.pScreen->RegionCopy)(expose, &pWin->clipList); + (*pPrivate->WindowExposures)(pWin, expose, pOtherRegion); + (*pWin->drawable.pScreen->RegionDestroy)(expose); + pWin->drawable.pScreen->WindowExposures = pPrivate->WindowExposures; + return; + } + (*pPrivate->WindowExposures)(pWin, pRegion, pOtherRegion); +} + +static int paintLogo(ScreenPtr pScreen) +{ + int visual; + int depth; + unsigned char c, *p, *buf; + unsigned int *q; + int i, csize, rascsize; + struct stat s; + FontFilePtr fnt; + ColormapPtr cptr; + xColorItem *xc, *xcp = NULL; + RASHDR ras; + unsigned char *rawcmap; + unsigned char *red, *green, *blue; + unsigned char *xr, *xg, *xb; + int x, y, w, h; + PixmapPtr pPixmap; + xRectangle rect; + DrawablePtr pDst; + ChangeGCVal attr[2]; + long rgf; + GCPtr pGC; + RegionPtr pRgn; + unsigned char name[256]; + VisualPtr pVisual; + extern WindowPtr *WindowTable; + SetupScreen(pScreen); + + /* Grab root visual */ + for (pVisual = pScreen->visuals; pVisual->vid != pScreen->rootVisual; pVisual++); + visual = pVisual->class; + depth = pScreen->rootDepth; + cptr = (ColormapPtr)LookupIDByType(WindowTable[pScreen->myNum]->drawable.pScreen->defColormap,RT_COLORMAP); + csize = pVisual->ColormapEntries; + pDst = (DrawablePtr)WindowTable[pScreen->myNum]; + + /* Open the appropriate logo file */ + c = '1'; + if (depth == 8 && visual == PseudoColor) + c = '8'; + else if (depth == 24 && (visual == TrueColor || visual == DirectColor)) + c = '8'; + else if (depth == 8 && (visual == StaticGray || visual == GrayScale)) + c = 'G'; + else if (depth > 1) + return -EINVAL; + p = name + sprintf(name, LOGO_PATH, c); + strcpy ((char *)p, ".gz"); + if (stat(name, &s)) { + strcpy ((char *)p, ".Z"); + if (stat(name, &s)) { + *p = '\0'; + if (stat(name, &s)) + return -ENOENT; + } + } + fnt = FontFileOpen(name); + if (!fnt) return -EBADF; + + FontFileRead(fnt, (char *)&ras, sizeof (ras)); + if (ras.ras_magic != RAS_MAGIC) { + FontFileClose(fnt); return -EBADF; + } + + h = ras.ras_height; + if (c != '1') { + switch (visual) { + case PseudoColor: + case GrayScale: + xr = (unsigned char *)xcalloc(256, 3); + xg = xr + 256; xb = xg + 256; + /* Start with black screen */ + pPrivate->UpdateColormap(pScreen, 0, 256, xr, xg, xb); + break; + case DirectColor: + xcp = (xColorItem *)xcalloc(csize, sizeof(xColorItem)); + default: + break; + } + /* Read Colormap */ + rawcmap = (unsigned char *)xalloc(ras.ras_maplength); + FontFileRead(fnt, rawcmap, ras.ras_maplength); + rascsize = ras.ras_maplength / 3; + red = rawcmap; green = rawcmap + rascsize; blue = rawcmap + 2 * rascsize; + if (c != '1' && depth == 24 && cptr->pVisual->nplanes == 24) { + if (cptr->pVisual->redMask == 0xff0000 && + cptr->pVisual->greenMask == 0xff00 && + cptr->pVisual->blueMask == 0xff) { + red = blue; + blue = rawcmap; + } + } + switch (visual) { + case PseudoColor: + case GrayScale: + memcpy(xr + 256 - rascsize, red, rascsize); + memcpy(xg + 256 - rascsize, green, rascsize); + memcpy(xb + 256 - rascsize, blue, rascsize); + xr[pScreen->blackPixel] = 0; + xg[pScreen->blackPixel] = 0; + xb[pScreen->blackPixel] = 0; + xr[pScreen->whitePixel] = 0xff; + xg[pScreen->whitePixel] = 0xff; + xb[pScreen->whitePixel] = 0xff; + break; + case DirectColor: + for (i = 0, xc = xcp; i < rascsize; i++, xc++) { + xc->flags = DoRed | DoGreen | DoBlue; xc->pixel = i | (i << 8) | (i << 16); + xc->red = (red[i] << 8) | red[i]; + xc->green = (green[i] << 8) | green[i]; + xc->blue = (blue[i] << 8) | blue[i]; + } + default: + break; + } + w = (ras.ras_width + 1) & ~1; + } else + w = (ras.ras_width + 15) & ~15; + + pGC = CreateScratchGC(pScreen, pScreen->rootDepth); + attr[0].val = pScreen->whitePixel; + dixChangeGC(NullClient, pGC, (GCForeground), NULL, attr); + ValidateGC(pDst, pGC); + rect.x = 0; rect.y = 0; rect.width = pScreen->width; rect.height = pScreen->height; + (*pGC->ops->PolyFillRect)(pDst, pGC, 1, &rect); + + pPixmap = (*pScreen->CreatePixmap)(pScreen, w, h, depth); + p = (unsigned char *)pPixmap->devPrivate.ptr; + + if (c != '1') { + buf = (unsigned char *)xalloc(w); + while (h-- > 0) { + FontFileRead(fnt, buf, w); + switch (visual) { + case TrueColor: + q = (unsigned *)p; + for (i = 0; i < w; i++) + *q++ = red[buf[i]] | (green[buf[i]] << 8) | (blue[buf[i]] << 16); + break; + case DirectColor: + q = (unsigned *)p; + for (i = 0; i < w; i++) + *q++ = buf[i] | (buf[i] << 8) | (buf[i] << 16); + break; + case StaticGray: + for (i = 0; i < w; i++) + *p++ = red[buf[i]]; + p -= w; + break; + default: + for (i = 0; i < w; i++) + *p++ = buf[i] - rascsize; + p -= w; + break; + } + p += pPixmap->devKind; + } + xfree(buf); + } else { + while (h-- > 0) { + FontFileRead(fnt, p, w); + p += pPixmap->devKind; + } + } + FontFileClose(fnt); + + x = (pScreen->width - w) >> 1; y = (pScreen->height - ras.ras_height) >> 1; + if (c != '1') { + pRgn = (*pGC->ops->CopyArea)((DrawablePtr)pPixmap, pDst, pGC, 0, 0, + ras.ras_width, ras.ras_height, x, y); + switch (visual) { + case PseudoColor: + case GrayScale: + pPrivate->UpdateColormap(pScreen, 0, 256, xr, xg, xb); + xfree(xr); + break; + case DirectColor: + pScreen->StoreColors(cptr, rascsize, xcp); + xfree(xcp); + break; + } + } else { + attr[0].val = pScreen->blackPixel; + attr[1].val = pScreen->whitePixel; + rgf = pScreen->rgf; pScreen->rgf = (unsigned)~2; + dixChangeGC(NullClient, pGC, (GCForeground | GCBackground), NULL, attr); + ValidateGC(pDst, pGC); + pRgn = (*pGC->ops->CopyPlane)((DrawablePtr)pPixmap, pDst, pGC, 0, 0, + ras.ras_width, ras.ras_height, x, y, 1); + pScreen->rgf = rgf; + } + if (rawcmap) xfree(rawcmap); + if (pRgn) (*pScreen->RegionDestroy)(pRgn); + FreeGC(pGC, 0); + (*pScreen->DestroyPixmap)(pPixmap); +} + +static void paintLogoWindowExposures(WindowPtr pWin, RegionPtr pRegion, RegionPtr pOtherRegion) +{ + ScreenPtr pScreen = pWin->drawable.pScreen; + SetupScreen(pScreen); + int err; + + if (paintLogo(pScreen) < 0) { + /* Fall back to x tailed all over the screen */ + (*pPrivate->WindowExposures)(pWin, pRegion, pOtherRegion); + pScreen->WindowExposures = pPrivate->WindowExposures; + } else + /* Clear the logo next time :) */ + pScreen->WindowExposures = clearLogoWindowExposures; +} + + #if NeedFunctionPrototypes pointer sunMemoryMap ( size_t len, off_t off, - int fd) + int scr) #else -pointer sunMemoryMap (len, off, fd) +pointer sunMemoryMap (len, off, scr) size_t len; off_t off; - int fd; + int scr; #endif { int pagemask, mapsize; caddr_t addr; pointer mapaddr; + int fd; + fd = sunFbs[scr].fd; #ifdef SVR4 pagemask = sysconf(_SC_PAGESIZE) - 1; #else @@ -103,7 +361,7 @@ mapsize = ((int) len + pagemask) & ~pagemask; addr = 0; -#if !defined(__bsdi__) && !defined(_MAP_NEW) +#if !defined(linux) && !defined(__bsdi__) && !defined(_MAP_NEW) if ((addr = (caddr_t) valloc (mapsize)) == NULL) { Error ("Couldn't allocate frame buffer memory"); (void) close (fd); @@ -129,6 +387,13 @@ (void) close (fd); mapaddr = (pointer) NULL; } +#ifdef linux + for (fd = 0; fd < 8; fd++) + if (!sunFbs[scr].sizes[fd]) + break; + sunFbs[scr].maps[fd] = (unsigned long)mapaddr; + sunFbs[scr].sizes[fd] = mapsize; +#endif return mapaddr; } @@ -233,6 +498,8 @@ #ifdef XKB } #endif + pPrivate->WindowExposures = pScreen->WindowExposures; + pScreen->WindowExposures = paintLogoWindowExposures; if (!sunCursorInitialize (pScreen)) miDCInitialize (pScreen, &sunPointerScreenFuncs); return TRUE; @@ -267,7 +534,7 @@ if (!fb) { if ((fb = sunMemoryMap ((size_t) sunFbs[scrn].info.fb_size, offset, - sunFbs[scrn].fd)) == NULL) + scrn)) == NULL) return FALSE; sunFbs[scrn].fb = fb; } --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunGX.c.sparc Sat Jul 8 06:55:54 1995 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunGX.c Fri Sep 20 19:14:03 2002 @@ -418,7 +418,8 @@ int width, height; int dstx, dsty; { - if (pSrcDrawable->type != DRAWABLE_WINDOW) + if (pSrcDrawable->type != DRAWABLE_WINDOW || + vtOn == pSrcDrawable->pScreen->myNum) return cfbCopyArea (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); return cfbBitBlt (pSrcDrawable, pDstDrawable, @@ -552,6 +553,9 @@ RegionPtr ret; int (*doBitBlt)(); + if (vtOn == pSrcDrawable->pScreen->myNum) + return cfbCopyPlane(pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); + if (pSrcDrawable->bitsPerPixel == 1 && pDstDrawable->bitsPerPixel == 8) { if (bitPlane == 1) @@ -664,6 +668,11 @@ int n; int xorg, yorg; + if (vtOn == pDrawable->pScreen->myNum) { + cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit); + return; + } + priv = (cfbPrivGC *) pGC->devPrivates[cfbGCPrivateIndex].ptr; prgnClip = priv->pCompositeClip; prect = prectInit; @@ -815,6 +824,10 @@ register int r; BoxPtr extents; + if (vtOn == pDrawable->pScreen->myNum) { + (gxPriv->FillSpans)(pDrawable, pGC, n, ppt, pwidth, fSorted); + return; + } GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask) if (gxPriv->stipple) GXStippleInit(gx,gxPriv->stipple); @@ -1074,6 +1087,10 @@ int old_width = 0; #endif + if (vtOn == pDraw->pScreen->myNum) { + (gxPriv->PolyFillArc)(pDraw, pGC, narcs, parcs); + return; + } GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask); if (gxPriv->stipple) GXStippleInit(gx,gxPriv->stipple); @@ -1191,6 +1208,10 @@ } GXPointRec, *GXPointPtr; GXPointPtr tri, qua; + if (vtOn == pDrawable->pScreen->myNum) { + (gxPriv->FillPolygon)(pDrawable, pGC, shape, mode, count, ptsIn); + return; + } if (count < 3) return; if (shape != Convex && count > 4) @@ -1324,6 +1345,10 @@ int r; unsigned char *baseAddr, *loAddr, *hiAddr, *saveAddr = 0, save; + if (vtOn == pDrawable->pScreen->myNum) { + (gxPriv->PolySegment)(pDrawable, pGC, nseg, pSeg); + return; + } GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask); if (gxPriv->stipple) GXStippleInit(gx,gxPriv->stipple); @@ -1391,6 +1416,10 @@ Bool careful; Bool capNotLast; + if (vtOn == pDrawable->pScreen->myNum) { + (gxPriv->Polylines)(pDrawable, pGC, mode, npt, ppt); + return; + } if (!--npt) return; GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_O,pGC->planemask); @@ -1513,6 +1542,11 @@ int r; int x, y; + if (vtOn == pDrawable->pScreen->myNum) { + miPolyRectangle (pDrawable, pGC, nrect, prect); + return; + } + GXDrawInit(gx,pGC->fgPixel,gx_solid_rop_table[pGC->alu]|POLY_N,pGC->planemask); if (gxPriv->stipple) GXStippleInit(gx,gxPriv->stipple); @@ -1551,6 +1585,11 @@ BoxPtr extents; BoxRec box; + if (vtOn == pDrawable->pScreen->myNum) { + sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC); + (gxPriv->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } clip = ((cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr))->pCompositeClip; extents = &clip->extents; @@ -1634,6 +1673,11 @@ RegionPtr clip; unsigned long rop; + if (vtOn == pDrawable->pScreen->myNum) { + sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC); + (gxPriv->ImageGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); h = FONTASCENT(pfont) + FONTDESCENT(pfont); clip = ((cfbPrivGC *)(pGC->devPrivates[cfbGCPrivateIndex].ptr))->pCompositeClip; @@ -1744,6 +1788,11 @@ CharInfoPtr *ppci; /* array of character info */ pointer pglyphBase; /* start of array of glyphs */ { + if (vtOn == pDrawable->pScreen->myNum) { + sunGXPrivGCPtr gxPriv = sunGXGetGCPrivate (pGC); + (gxPriv->PolyGlyphBlt)(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } sunGXTEGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, (char *) 1); } @@ -2380,6 +2429,19 @@ pGC->ops->devPrivate.val = 1; } } +#ifdef linux + if (newops = cfbMatchCommon (pGC, devPriv)) + { + gxPriv->FillSpans = newops->FillSpans; + gxPriv->PolyFillArc = newops->PolyFillArc; + gxPriv->FillPolygon = newops->FillPolygon; + gxPriv->PolySegment = newops->PolySegment; + gxPriv->Polylines = newops->Polylines; + gxPriv->PolyGlyphBlt = newops->PolyGlyphBlt; + gxPriv->ImageGlyphBlt = newops->ImageGlyphBlt; + } +#endif + } canGX = pGC->fillStyle == FillSolid || gxPriv->stipple; @@ -2388,8 +2450,15 @@ if (new_line) { pGC->ops->FillPolygon = miFillPolygon; - if (devPriv->oneRect && canGX) + if (devPriv->oneRect && canGX) + { +#ifdef linux + gxPriv->FillPolygon = miFillPolygon; + if (pGC->fillStyle == FillSolid) + gxPriv->FillPolygon = (devPriv->rop == GXcopy) ? cfbFillPoly1RectCopy : cfbFillPoly1RectGeneral; +#endif pGC->ops->FillPolygon = sunGXFillPoly1Rect; + } if (pGC->lineWidth == 0) { if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) @@ -2420,6 +2489,10 @@ { if (devPriv->oneRect && canGX && widOK) { +#ifdef linux + gxPriv->PolySegment = cfb8SegmentSS1Rect; + gxPriv->Polylines = cfb8LineSS1Rect; +#endif pGC->ops->PolySegment = sunGXPolySeg1Rect; pGC->ops->Polylines = sunGXPolylines1Rect; } @@ -2466,6 +2539,13 @@ { if (pGC->fillStyle == FillSolid) { +#ifdef linux + gxPriv->PolyGlyphBlt = +#ifdef WriteBitGroup + (devPriv->rop == GXcopy) ? cfbPolyGlyphBlt8 : +#endif + miPolyGlyphBlt; +#endif if (TERMINALFONT (pGC->font)) pGC->ops->PolyGlyphBlt = sunGXPolyTEGlyphBlt; else @@ -2483,9 +2563,14 @@ if (new_fillspans) { - if (canGX) - pGC->ops->FillSpans = sunGXFillSpans; - else switch (pGC->fillStyle) { + switch (pGC->fillStyle) { + case FillSolid: + switch(devPriv->rop) { + case GXcopy: pGC->ops->FillSpans = cfbSolidSpansCopy; break; + case GXxor: pGC->ops->FillSpans = cfbSolidSpansXor; break; + default: pGC->ops->FillSpans = cfbSolidSpansGeneral; break; + } + break; case FillTiled: if (devPriv->pRotatedPixmap) { @@ -2512,6 +2597,12 @@ default: FatalError("cfbValidateGC: illegal fillStyle\n"); } + if (canGX) { +#ifdef linux + gxPriv->FillSpans = pGC->ops->FillSpans; +#endif + pGC->ops->FillSpans = sunGXFillSpans; + } } /* end of new_fillspans */ if (new_fillarea) { @@ -2519,6 +2610,11 @@ pGC->ops->PolyFillArc = miPolyFillArc; if (canGX) { +#ifdef linux + gxPriv->PolyFillArc = miPolyFillArc; + if (pGC->fillStyle == FillSolid) + gxPriv->PolyFillArc = (devPriv->rop == GXcopy) ? cfbPolyFillArcSolidCopy : cfbPolyFillArcSolidGeneral; +#endif pGC->ops->PolyFillArc = sunGXPolyFillArc; pGC->ops->PolyFillRect = sunGXPolyFillRect; if (devPriv->oneRect) @@ -2554,6 +2650,20 @@ gxPriv = sunGXGetGCPrivate(pGC); gxPriv->type = DRAWABLE_WINDOW; gxPriv->stipple = 0; +#ifdef linux + gxPriv->FillSpans = cfbSolidSpansCopy; + gxPriv->PolyFillArc = cfbPolyFillArcSolidCopy; + gxPriv->FillPolygon = miFillPolygon; + gxPriv->PolySegment = cfbSegmentSS; + gxPriv->Polylines = cfbLineSS; +#ifdef WriteBitGroup + gxPriv->PolyGlyphBlt = cfbImageGlyphBlt8; + gxPriv->ImageGlyphBlt = cfbPolyGlyphBlt8; +#else + gxPriv->PolyGlyphBlt = miImageGlyphBlt; + gxPriv->ImageGlyphBlt = miPolyGlyphBlt; +#endif +#endif return TRUE; } @@ -2733,6 +2843,10 @@ WindowPtr pBgWin; pPrivWin = (cfbPrivWin *)(pWin->devPrivates[cfbWindowPrivateIndex].ptr); + if (vtOn == pWin->drawable.pScreen->myNum) { + cfbPaintWindow(pWin, pRegion, what); + return; + } switch (what) { case PW_BACKGROUND: stipple = sunGXGetWindowPrivate(pWin); @@ -2828,6 +2942,11 @@ WindowPtr pwinRoot; extern WindowPtr *WindowTable; + if (!vtOn) { + cfbCopyWindow(pWin, ptOldOrg, prgnSrc); + return; + } + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunGX.h.sparc Wed Apr 27 07:14:49 1994 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunGX.h Fri Sep 20 19:14:19 2002 @@ -229,6 +229,89 @@ typedef struct _sunGXPrivGC { int type; sunGXStipplePtr stipple; + + void (* FillSpans)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*nInit*/, + DDXPointPtr /*pptInit*/, + int * /*pwidthInit*/, + int /*fSorted*/ +#endif +); + + void (* Polylines)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*mode*/, + int /*npt*/, + DDXPointPtr /*pptInit*/ +#endif +); + + void (* PolySegment)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*nseg*/, + xSegment * /*pSegs*/ +#endif +); + + void (* PolyArc)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*narcs*/, + xArc * /*parcs*/ +#endif +); + + void (* FillPolygon)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*shape*/, + int /*mode*/, + int /*count*/, + DDXPointPtr /*pPts*/ +#endif +); + + void (* PolyFillArc)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*narcs*/, + xArc * /*parcs*/ +#endif +); + + void (* ImageGlyphBlt)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*x*/, + int /*y*/, + unsigned int /*nglyph*/, + CharInfoPtr * /*ppci*/, + pointer /*pglyphBase*/ +#endif +); + + void (* PolyGlyphBlt)( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*x*/, + int /*y*/, + unsigned int /*nglyph*/, + CharInfoPtr * /*ppci*/, + pointer /*pglyphBase*/ +#endif +); } sunGXPrivGCRec, *sunGXPrivGCPtr; #define sunGXGetGCPrivate(g) ((sunGXPrivGCPtr) \ --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunInit.c.sparc Mon Feb 16 00:40:55 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunInit.c Fri Sep 20 19:14:21 2002 @@ -51,6 +51,10 @@ #include "mi.h" #include "mibstore.h" #include "cfb.h" +#include +#ifdef linux +#include +#endif /* maximum pixmap depth */ #ifndef SUNMAXDEPTH @@ -77,6 +81,8 @@ #define CG6I NULL #define CG8I NULL #define TCXI NULL +#define CG14I NULL +#define FFBI NULL #else /* }{ */ extern Bool sunCG3Init( #if NeedFunctionPrototypes @@ -87,7 +93,7 @@ #endif ); #define CG3I sunCG3Init -#if defined(i386) || defined(__bsdi__) /* { */ +#if defined(linux) || defined(i386) || defined(__bsdi__) /* { */ #define CG2I NULL #define CG4I NULL #else /* }{ */ @@ -124,7 +130,7 @@ #define CG6I NULL #endif /* } */ #ifdef XFBTYPE_TCX /* { */ -extern Bool sunTCXInit( +static Bool sunTCXInit( #if NeedFunctionPrototypes int /* screen */, ScreenPtr /* pScreen */, @@ -136,6 +142,41 @@ #else /* }{ */ #define TCXI NULL #endif /* } */ + +#ifdef FBTYPE_MDICOLOR +extern Bool sunCG14Init( +#if NeedFunctionPrototypes + int /* screen */, + ScreenPtr /* pScreen */, + int /* argc */, + char** /* argv */ +#endif +); +#define CG14I sunCG14Init +#else /* }{ */ +#define FBTYPE_MDICOLOR NULL +#endif +#if SUNMAXDEPTH < 9 +#undef CG14I +#define CG14I NULL +#endif + +#ifdef XFBTYPE_FFB +extern Bool sunFFBInit( +#if NeedFunctionPrototypes + int /* screen */, + ScreenPtr /* pScreen */, + int /* argc */, + char** /* argv */ +#endif +); +#define FFBI sunFFBInit +#endif +#if SUNMAXDEPTH < 9 +#undef FFBI +#define FFBI NULL +#endif + #if SUNMAXDEPTH > 8 /* { */ #ifdef FBTYPE_MEMCOLOR /* { */ extern Bool sunCG8Init( @@ -217,11 +258,14 @@ { NULL, "SUNLEO (zx)" }, #endif #ifdef FBTYPE_MDICOLOR - { NULL, "MDICOLOR (cgfourteen)" }, + { CG14I, "MDICOLOR (cgfourteen)" }, #endif #ifdef XFBTYPE_TCX { TCXI, "TCX (tcx)" }, #endif +#ifdef XFBTYPE_FFB + { FFBI, "FFB (creator)" }, +#endif #endif /* } */ }; @@ -232,6 +276,9 @@ #if SUNMAXDEPTH == 1 /* { */ static char *fallbackList[] = { BWTWO0DEV, BWTWO1DEV, BWTWO2DEV +#ifdef linux + , "/dev/fb" +#endif }; #else /* }{ */ static char *fallbackList[] = { @@ -288,6 +335,40 @@ }; #define NUMFORMATS (sizeof formats)/(sizeof formats[0]) +#if SUNMAXDEPTH > 1 /* { */ +#ifdef XFBTYPE_TCX /* { */ +extern Bool sunTCX8Init( +#if NeedFunctionPrototypes + int /* screen */, + ScreenPtr /* pScreen */, + int /* argc */, + char** /* argv */ +#endif +); + +#if SUNMAXDEPTH > 8 +extern Bool sunTCX24Init( +#if NeedFunctionPrototypes + int /* screen */, + ScreenPtr /* pScreen */, + int /* argc */, + char** /* argv */ +#endif +); +#endif + +static Bool sunTCXInit(int screen, ScreenPtr pScreen, int argc, char** argv) +{ +#if SUNMAXDEPTH > 8 + if (sunFbs [screen].info.fb_depth > 8) /* Is it 24bit deep TCX or just tcx-8-bit? */ + return sunTCX24Init (screen, pScreen, argc, argv); + else +#endif + return sunTCX8Init (screen, pScreen, argc, argv); +} +#endif /* } */ +#endif /* } */ + /* * OpenFrameBuffer -- * Open a frame buffer according to several rules. @@ -362,7 +443,20 @@ } if (!ret) sunFbs[screen].fd = -1; - return ret; +#ifdef linux + else { + sunFbs[screen].cursor_type = 0; + sunFbs[screen].cursor_regs = 0; + sunFbs[screen].origcmap.index = 0; + sunFbs[screen].origcmap.count = 16; + sunFbs[screen].origcmap.red = (unsigned char *)xalloc(64); + sunFbs[screen].origcmap.green = (unsigned char *)xalloc(64); + sunFbs[screen].origcmap.blue = (unsigned char *)xalloc(64); + if (ioctl (sunFbs[screen].fd, FBIOGETCMAP, &(sunFbs[screen].origcmap)) < 0) + sunFbs[screen].origcmap.count = 0; + } +#endif + return ret; } /*- @@ -406,9 +500,13 @@ #if defined(SVR4) || defined(CSRG_BASED) void #else +#ifdef linux + int status, void *arg +#else char* arg #endif #endif +#endif ) { register int i; @@ -470,7 +568,7 @@ * matter since no 386i has ever been shipped with a type 3 keyboard. * SunOS 4.1 no longer needs this kludge. */ -#if !defined(i386) && !defined(KIOCGKEY) +#if !defined(i386) && !defined(KIOCGKEY) && !defined(linux) #define TYPE4KEYBOARDOVERRIDE #endif @@ -552,6 +650,10 @@ } } +#ifdef linux +extern void OpenLinuxConsole(); +#endif + /*- *----------------------------------------------------------------------- * InitOutput -- @@ -611,6 +713,9 @@ ErrorF("InitOutput: can't put stderr in non-block mode\n"); } } +#ifdef linux + OpenLinuxConsole(); +#endif pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; @@ -634,6 +739,18 @@ sunDevsInited = TRUE; xfree (devList); } +#ifdef linux + for (scr = 0; scr < MAXSCREENS; scr++) + if (sunFbs[scr].fd != -1) { + struct stat mystat; + + if (fstat (sunFbs[scr].fd, &mystat) >= 0) + if ((mystat.st_rdev & 0xff) == 0) { + linuxSetConsoleFb (scr); + break; + } + } +#endif for (scr = 0; scr < MAXSCREENS; scr++) if (sunFbs[scr].fd != -1) (void) AddScreen (sunFbData[sunFbs[scr].info.fb_type].init, @@ -662,11 +779,18 @@ { DeviceIntPtr p, k; extern Bool mieqInit(); +#ifdef linux + extern DeviceIntPtr linuxMouse, linuxKeyboard; +#endif p = AddInputDevice(sunMouseProc, TRUE); k = AddInputDevice(sunKbdProc, TRUE); if (!p || !k) FatalError("failed to create input devices in InitInput"); +#ifdef linux + linuxMouse = p; + linuxKeyboard = k; +#endif RegisterPointerDevice(p); RegisterKeyboardDevice(k); @@ -677,7 +801,19 @@ (void) OsSignal(SIGPOLL, SigIOHandler); #define WANT_SIGNALS(fd) ioctl(fd, I_SETSIG, S_INPUT | S_HIPRI) #else +#ifdef linux + { + struct sigaction act; + + sigemptyset(&act.sa_mask); + sigaddset(&act.sa_mask, SIGIO); + act.sa_flags = SA_RESTART; + act.sa_handler = SigIOHandler; + sigaction(SIGIO, &act, 0); + } +#else (void) OsSignal(SIGIO, SigIOHandler); +#endif #define WANT_SIGNALS(fd) fcntl(fd, F_SETOWN, getpid()) #endif if (sunKbdPriv.fd >= 0) { @@ -919,3 +1055,71 @@ #endif /* SUNMAXDEPTH == 32 */ #endif /* SUNMAXDEPTH */ + +#ifdef linux +void +sunDoBitBlt(ppix, pspix, bpp, pixReg, pixPt) + DrawablePtr ppix, pspix; + int bpp; + RegionPtr pixReg; + DDXPointPtr pixPt; +{ + switch (bpp) { + case 1: + mfbDoBitblt(ppix, pspix, GXcopy, pixReg, pixPt); + break; +#if SUNMAXDEPTH > 1 + case 8: + cfbDoBitblt(ppix, pspix, GXcopy, pixReg, pixPt, 0xFF); + break; +#endif +#if SUNMAXDEPTH > 8 + case 16: + cfb16DoBitblt(ppix, pspix, GXcopy, pixReg, pixPt, 0xFFFF); + break; + case 24: + case 32: + cfb32DoBitblt(ppix, pspix, GXcopy, pixReg, pixPt, 0xFFFFFFFF); + break; +#endif + } +} + +void +sunRefreshColormap(idx) + int idx; +{ + SetupScreen(screenInfo.screens[idx]); + ColormapPtr cmap; + +#if SUNMAXDEPTH > 1 + /* Hack to restore correct cmap */ + cmap = pPrivate->installedMap; + if (cmap) { + WalkTree(cmap->pScreen,TellLostMap,(pointer) &(cmap->mid)); + pPrivate->installedMap = NULL; + sunInstallColormap(cmap); + } +#endif +} + +PixmapPtr +sunGetScreenPixmap(screen) + int screen; +{ + ScreenPtr pScreen = screenInfo.screens [screen]; + + switch (pScreen->rootDepth) { + case 1: return (PixmapPtr) pScreen->devPrivate; +#if SUNMAXDEPTH > 1 + case 8: return (PixmapPtr) pScreen->devPrivate; +#endif +#if SUNMAXDEPTH > 8 + case 16: return (PixmapPtr) pScreen->devPrivates [cfb16ScreenPrivateIndex].ptr; + case 24: + case 32: return (PixmapPtr) pScreen->devPrivates [cfb32ScreenPrivateIndex].ptr; +#endif + default: ErrorF ("Wrong depth %d\n", pScreen->rootDepth); return NULL; + } +} +#endif --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunIo.c.sparc Wed May 21 15:02:18 1997 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunIo.c Fri Sep 20 19:14:23 2002 @@ -175,8 +175,12 @@ #if defined(SVR4) || defined(CSRG_BASED) sunNonBlockConsoleOff (); #else +#ifdef linux + sunNonBlockConsoleOff (0, NULL); +#else sunNonBlockConsoleOff (NULL); #endif +#endif for (i = 0; i < screenInfo.numScreens; i++) { pScreen = screenInfo.screens[i]; @@ -189,7 +193,13 @@ void ddxGiveUp() { +#ifdef linux + extern void CloseLinuxConsole(); +#endif AbortDDX (); +#ifdef linux + CloseLinuxConsole(); +#endif } int @@ -199,9 +209,19 @@ int i; { extern void UseMsg(); - #ifdef XKB int noxkb = 0, n; +#endif + +#ifdef linux + extern int linuxProcessArgument(int argc, char *argv[], int i); + int ret; + + ret = linuxProcessArgument(argc, argv, i); + if (ret) return ret; +#endif + +#ifdef XKB /* * peek in argv and see if -kb because noXkbExtension won't * get set until too late to useful here. @@ -290,5 +310,10 @@ #ifdef UNDOCUMENTED ErrorF("-cg4frob don't use the mono plane of the cgfour\n"); ErrorF("-noGX treat the GX as a dumb frame buffer\n"); +#endif +#ifdef linux + ErrorF("vtXX use the specified VT number\n"); + ErrorF("-keeptty "); + ErrorF("don't detach controlling tty (for debugging only)\n"); #endif } --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunKbd.c.sparc Sun Oct 4 15:31:14 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunKbd.c Fri Sep 20 19:14:24 2002 @@ -81,6 +81,11 @@ extern KeySymsRec sunKeySyms[]; extern SunModmapRec* sunModMaps[]; +#ifdef linux +extern int consoleFd; +#include +#endif + long sunAutoRepeatInitiate = 1000 * AUTOREPEAT_INITIATE; long sunAutoRepeatDelay = 1000 * AUTOREPEAT_DELAY; @@ -888,6 +893,10 @@ xEvent xE; BYTE keycode; CARD8 keyModifiers; +#ifdef linux + KeySym ksym; + extern Bool NoVT; +#endif keycode = (fe->id & 0x7f) + MIN_KEYCODE; @@ -908,6 +917,39 @@ xE.u.keyButtonPointer.time = TVTOMILLI(fe->time); xE.u.u.type = ((fe->value == VKEY_UP) ? KeyRelease : KeyPress); xE.u.u.detail = keycode; +#ifdef linux + if ((device->key->state & ControlMask) +#ifdef XKB + /* For unknown reason, XKB mapping of ALT_L migrated from Mod3 to Mod2... */ + && ((!noXkbExtension && (device->key->state & Mod2Mask)) || + (noXkbExtension && (device->key->state & Mod3Mask))) +#else + && (device->key->state & Mod3Mask) +#endif + ) + switch (ksym = device->key->curKeySyms.map[(fe->id - 1) * device->key->curKeySyms.mapWidth]) { + case XK_BackSpace: + if (xE.u.u.type == KeyPress) + GiveUp(0); + return; + case XK_F1: + case XK_F2: + case XK_F3: + case XK_F4: + case XK_F5: + case XK_F6: + case XK_F7: + case XK_F8: + case XK_F9: + case XK_F10: + case XK_F11: + case XK_F12: + if (!NoVT && xE.u.u.type == KeyPress) + ioctl(consoleFd, VT_ACTIVATE, ksym - XK_F1 + 1); + return; + } +#endif + #ifdef XKB if (noXkbExtension) { #endif --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunFFB.c.sparc Fri Sep 20 19:14:26 2002 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunFFB.c Fri Sep 20 19:14:26 2002 @@ -0,0 +1,994 @@ +/* +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to 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. + + Acceleration for the Creator and Creator3D framebuffer. + + Author: Michal "Hobit" Rehacek (majkl@iname.com) +*/ + + +#define PSZ 32 +#include +#include "sun.h" + +#include "Xmd.h" +#include "gcstruct.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "regionstr.h" +#include "mistruct.h" +#include "fontstruct.h" +#include "dixfontstr.h" +#include "cfb/cfb.h" +#include "cfb/cfbmskbits.h" +#include "cfb/cfb8bit.h" +#include "fastblt.h" +#include "mergerop.h" +#include "migc.h" + +#include "sunFFB.h" +#include + + +int CreatorScreenPrivateIndex; +int CreatorGCPrivateIndex; +int CreatorWindowPrivateIndex; +int CreatorGeneration; + + +/* Here are the macros that perform the real drawing. The functions + are only wrappers that check some conditions, perform software + clipping and some other tasks needed to be done before the real + drawing can begin. */ + +/* Prepare for drawing one or more rectangles. We set all the parameters + except for coordinates. This means color, ROP, and a planemask. The other + values are needed but we know about them no more than that. */ +#define CREATOR_RECT_START(ffb,_FG,_PLANEMASK,_ALU) \ + ffb->ppc = 0x1803; \ + ffb->fg = _FG; \ + ffb->fbc = 0x2000707f; \ + ffb->rop = 0x80 | (_ALU); \ + ffb->pmask = _PLANEMASK; \ + ffb->unk2 = 8 + +/* Draw one rectangle using given coordinates. Caution - x2 stands for + width and y2 for height. The width must be set last of the coordinates + because drawing starts just after setting the width. */ +#define CREATOR_RECT_BODY(ffb,x1,y1,x2,y2) \ + ffb->by = y1; \ + ffb->bx = x1; \ + ffb->bh = y2; \ + ffb->bw = x2 + +/* Finished drawing rectangles, so call this macro. In these days it does + nothing but this may change in the future. */ +#define CREATOR_RECT_END() + + +/* Prepare for drawing a set of glyphs. We will draw them transparently + but for we do not know how to do it using one operation, we use a little + trick with ROP. See the documentation. */ +#define CREATOR_BLITC_START(ffb,_FG) \ + ffb->ppc = 0x203; \ + ffb->fg = _FG; \ + ffb->fbc = 0x2000707F; \ + ffb->pmask = 0xffffffff + +#define CREATOR_BLITC_TRANSPARENT(ffb,_X,_Y,_W,_H, _BITS) \ + { \ + unsigned long * b = _BITS; \ + int i; \ + ffb->fontw = _W; \ + ffb->fontinc = 0x10000; \ + ffb->fontxy = (_Y << 16) + _X; \ + ffb->bg = 0xFFFFFFFF; \ + ffb->rop = 0x81; \ + for (i = 0; i < _H; i++) ffb->font = (* b ++); \ + ffb->fontxy = (_Y << 16) + _X; \ + ffb->bg = 0x00000000; \ + ffb->rop = 0x87; \ + b = _BITS; \ + for (i = 0; i < _H; i++) ffb->font = (* b ++); \ + } + + +#define CREATOR_BLITC_END() + + +/* Wait for the Creator to complete a pending operation, if any. */ +#define CREATOR_WAIT(ffb) \ + while ((ffb->ucsr & 0x02000000) != 0) ; + + +static const char * Debug_LOGNAME = "/home/mreh4379/log"; + + +static void DebugOutput (const char * Text, int Delta) +{ + static int Level = 0; + FILE * fajl; + char buf [512]; + memset (buf, ' ', sizeof buf); + if (Delta < 0) Level += Delta; + sprintf (buf + Level, "%s\n", Text); + if (Delta > 0) Level += Delta; + fajl = fopen (Debug_LOGNAME, "a"); + fputs (buf, fajl); + fclose (fajl); +} + + +#define Debug_Enter(Name) DebugOutput ("+" Name, +1) +#define Debug_Leave(Name) DebugOutput ("-" Name, -1) + + +static void +CreatorFillRectAll (pDrawable, pGC, nBox, pBox) + DrawablePtr pDrawable; + GCPtr pGC; + int nBox; + BoxPtr pBox; +{ + CreatorPrivScreenPtr Private = CreatorGetScreenPrivate (pDrawable->pScreen); + ffb_fbcPtr ffb = Private->Registry; + CreatorPrivGCPtr Priv = CreatorGetGCPrivate (pDrawable->pScreen); + + CREATOR_RECT_START (ffb, pGC->fgPixel, pGC->planemask, pGC->alu); + while (nBox--) { + int x = pBox->x1; + int y = pBox->y1; + int w = pBox->x2 - pBox->x1; + int h = pBox->y2 - pBox->y1; + int i, dy, dx; + CREATOR_RECT_BODY (ffb, x, y, w, h); + CREATOR_WAIT (ffb); + pBox++; + } + CREATOR_RECT_END (); +} + + +#define NUM_STACK_RECTS 1024 + + +static void +CreatorPolyFillRect(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; + int n; + int xorg, yorg; + + + if ( + (vtOn == pDrawable->pScreen->myNum) || + (pGC->fillStyle != FillSolid) + ) { + cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit); + return; + } + + priv = (cfbPrivGC *) pGC->devPrivates[cfbGCPrivateIndex].ptr; + prgnClip = priv->pCompositeClip; + prect = prectInit; + xorg = pDrawable->x; + yorg = pDrawable->y; + if (xorg || yorg) + { + prect = prectInit; + n = nrectFill; + while (n--) + { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS (prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) + { + pboxClippedBase = (BoxPtr)ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + if (! pboxClippedBase) return; + } else pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) + { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && (pboxClipped->y1 < pboxClipped->y2)) + { + pboxClipped++; + } + } + } else { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) + { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int) prect->x + (int) prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int) prect->y + (int) prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) continue; + + n = REGION_NUM_RECTS (prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + this is logically equivalent to calling Intersect() + */ + while(n--) + { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if(pboxClipped->x1 < pboxClipped->x2 && pboxClipped->y1 < pboxClipped->y2) + { + pboxClipped++; + } + } + } + } + + if (pboxClipped != pboxClippedBase) + CreatorFillRectAll (pDrawable, pGC, pboxClipped - pboxClippedBase, pboxClippedBase); + if (pboxClippedBase != stackRects) + DEALLOCATE_LOCAL (pboxClippedBase); +} + + +static void +CreatorPolyGlyphBlt (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; +{ + CreatorPrivGCPtr gxPriv = CreatorGetGCPrivate (pGC); + CreatorPrivScreenPtr Private = CreatorGetScreenPrivate (pGC->pScreen); + ffb_fbcPtr Registry = Private->Registry; + RegionPtr clip; + BoxPtr extents; + CharInfoPtr pci; + int w, h, x0, y0; + unsigned long * bits; + BoxRec box; + char buf [256]; + + if (vtOn == pDrawable->pScreen->myNum) { + (gxPriv->PolyGlyphBlt) (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + return; + } + + clip = ((cfbPrivGC *) (pGC->devPrivates [cfbGCPrivateIndex] .ptr)) ->pCompositeClip; + extents = & clip->extents; + + /* compute an approximate (but covering) bounding box */ + box.x1 = 0; + if ((ppci[0]->metrics.leftSideBearing < 0)) + box.x1 = ppci[0]->metrics.leftSideBearing; + h = nglyph - 1; + w = ppci[h]->metrics.rightSideBearing; + while (--h >= 0) + w += ppci[h]->metrics.characterWidth; + box.x2 = w; + box.y1 = -FONTMAXBOUNDS(pGC->font,ascent); + box.y2 = FONTMAXBOUNDS(pGC->font,descent); + + box.x1 += pDrawable->x + x; + box.x2 += pDrawable->x + x; + box.y1 += pDrawable->y + y; + box.y2 += pDrawable->y + y; + + switch (RECT_IN_REGION(pGC->pScreen, clip, &box)) { + case rgnPART: cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pglyphBase); + case rgnOUT: return; } + + if (pGC->miTranslate) { + x += pDrawable->x; + y += pDrawable->y; + } + + CREATOR_BLITC_START (Registry, pGC->fgPixel); + + while (nglyph--) + { + pci = *ppci++; + w = GLYPHWIDTHPIXELS (pci); + h = GLYPHHEIGHTPIXELS (pci); + if ((w == 0) || (h == 0)) continue; + x0 = x + pci->metrics.leftSideBearing; + y0 = y - pci->metrics.ascent; + + bits = (unsigned long *) pci->bits; + CREATOR_BLITC_TRANSPARENT (Registry, x0, y0, w, h, bits); + + x += pci->metrics.characterWidth; + } + + CREATOR_BLITC_END (); +} + + + +GCOps CreatorTEOps1Rect = { + cfbSolidSpansCopy, + cfbSetSpans, + cfbPutImage, + cfbCopyArea, + cfbCopyPlane, + cfbPolyPoint, + cfb8LineSS1Rect, + cfb8SegmentSS1Rect, + miPolyRectangle, + cfbZeroPolyArcSS8Copy, + cfbFillPoly1RectGeneral, + CreatorPolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + cfbTEGlyphBlt, + miPolyGlyphBlt, + mfbPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + + +GCOps CreatorTEOps = { + cfbSolidSpansCopy, + cfbSetSpans, + cfbPutImage, + cfbCopyArea, + cfbCopyPlane, + cfbPolyPoint, + cfbLineSS, + cfbSegmentSS, + miPolyRectangle, + cfbZeroPolyArcSS8Copy, + miFillPolygon, + CreatorPolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + cfbTEGlyphBlt, + miPolyGlyphBlt, + mfbPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + + +GCOps CreatorNonTEOps1Rect = { + cfbSolidSpansCopy, + cfbSetSpans, + cfbPutImage, + cfbCopyArea, + cfbCopyPlane, + cfbPolyPoint, + cfb8LineSS1Rect, + cfb8SegmentSS1Rect, + miPolyRectangle, + cfbZeroPolyArcSS8Copy, + cfbFillPoly1RectGeneral, + CreatorPolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + miImageGlyphBlt, + CreatorPolyGlyphBlt, /* miPolyGlyphBlt, */ + mfbPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + + +GCOps CreatorNonTEOps = { + cfbSolidSpansCopy, + cfbSetSpans, + cfbPutImage, + cfbCopyArea, + cfbCopyPlane, + cfbPolyPoint, + cfbLineSS, + cfbSegmentSS, + miPolyRectangle, + cfbZeroPolyArcSS8Copy, + miFillPolygon, + CreatorPolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + miImageGlyphBlt, + CreatorPolyGlyphBlt, /* miPolyGlyphBlt, */ + mfbPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + + +#define FONTWIDTH(font) (FONTMAXBOUNDS(font,rightSideBearing) - \ + FONTMINBOUNDS(font,leftSideBearing)) + + +static GCOps * +CreatorMatchCommon (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 && + FONTWIDTH (pGC->font) <= 32 && + FONTMINBOUNDS(pGC->font,characterWidth) >= 0) + { + if (TERMINALFONT(pGC->font)) + if (devPriv->oneRect) + return &CreatorTEOps1Rect; + else + return &CreatorTEOps; + else + if (devPriv->oneRect) + return &CreatorNonTEOps1Rect; + else + return &CreatorNonTEOps; + } + return 0; +} + + +void +CreatorValidateGC (pGC, changes, pDrawable) + 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; + CreatorPrivGCPtr gxPriv; + int oneRect; + int canGX; + + gxPriv = CreatorGetGCPrivate (pGC); + if (pDrawable->type != DRAWABLE_WINDOW) + { + if (gxPriv->type == DRAWABLE_WINDOW) + { + extern GCOps cfbNonTEOps; + + miDestroyGCOps (pGC->ops); + pGC->ops = &cfbNonTEOps; + changes = (1 << GCLastBit+1) - 1; + pGC->stateChanges = changes; + gxPriv->type = pDrawable->type; + } + cfbValidateGC (pGC, changes, pDrawable); + return; + } + if (gxPriv->type != DRAWABLE_WINDOW) + { + changes = (1 << GCLastBit+1) - 1; + gxPriv->type = DRAWABLE_WINDOW; + } + + new_rotate = pGC->lastWinOrg.x != pDrawable->x || + pGC->lastWinOrg.y != pDrawable->y; + + pGC->lastWinOrg.x = pDrawable->x; + pGC->lastWinOrg.y = pDrawable->y; + + devPriv = ((cfbPrivGCPtr) (pGC->devPrivates[cfbGCPrivateIndex].ptr)); + + 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); + oneRect = REGION_NUM_RECTS(devPriv->pCompositeClip) == 1; + if (oneRect != devPriv->oneRect) + { + new_line = TRUE; + new_fillarea = TRUE; + devPriv->oneRect = oneRect; + } + } + + 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 GCCapStyle: + break; + case GCJoinStyle: + 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: + 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 and 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; + + if (!new_pix && devPriv->pRotatedPixmap) + { + cfbDestroyPixmap(devPriv->pRotatedPixmap); + devPriv->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 = CreatorMatchCommon (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; + } + } + +#ifdef linux + if (newops = cfbMatchCommon (pGC, devPriv)) + { + gxPriv->PolyGlyphBlt = newops->PolyGlyphBlt; + } +#endif + + } + + canGX = pGC->fillStyle == FillSolid; + canGX = 1; + + /* deal with the changes we've collected */ + if (new_line) + { + pGC->ops->FillPolygon = miFillPolygon; + if (pGC->lineWidth == 0) + { + if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) + { + switch (devPriv->rop) + { + case GXxor: + pGC->ops->PolyArc = cfbZeroPolyArcSS8Xor; + break; + case GXcopy: + pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy; + break; + default: + pGC->ops->PolyArc = cfbZeroPolyArcSS8General; + break; + } + } + else + pGC->ops->PolyArc = miZeroPolyArc; + } + else + pGC->ops->PolyArc = miPolyArc; + pGC->ops->PolySegment = miPolySegment; + switch (pGC->lineStyle) + { + case LineSolid: + if(pGC->lineWidth == 0) + { + if (devPriv->oneRect && canGX) + { + } + else if (pGC->fillStyle == FillSolid) + { + if (devPriv->oneRect) + { + pGC->ops->Polylines = cfb8LineSS1Rect; + pGC->ops->PolySegment = cfb8SegmentSS1Rect; + } + else + { + pGC->ops->Polylines = cfbLineSS; + pGC->ops->PolySegment = cfbSegmentSS; + } + } + 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 = cfbLineSD; + pGC->ops->PolySegment = cfbSegmentSD; + } else + pGC->ops->Polylines = miWideDash; + break; + } + } + + if (new_text && (pGC->font)) + { + if (FONTWIDTH(pGC->font) > 32 || + FONTMINBOUNDS(pGC->font,characterWidth) < 0) + { + pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; + pGC->ops->ImageGlyphBlt = miImageGlyphBlt; + } + + else + { + if (pGC->fillStyle == FillSolid) + { + if (TERMINALFONT (pGC->font)) + /* pGC->ops->PolyGlyphBlt = CreatorPolyTEGlyphBlt */ ; + else + pGC->ops->PolyGlyphBlt = CreatorPolyGlyphBlt; + } + else + pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; + pGC->ops->ImageGlyphBlt = miImageGlyphBlt; + } + } + + + if (new_fillspans) { + switch (pGC->fillStyle) { + case FillSolid: + switch(devPriv->rop) { + case GXcopy: pGC->ops->FillSpans = cfbSolidSpansCopy; break; + case GXxor: pGC->ops->FillSpans = cfbSolidSpansXor; break; + default: pGC->ops->FillSpans = cfbSolidSpansGeneral; break; + } + break; + case FillTiled: + if (devPriv->pRotatedPixmap) + { + if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) + pGC->ops->FillSpans = cfbTile32FSCopy; + else + pGC->ops->FillSpans = cfbTile32FSGeneral; + } + else + pGC->ops->FillSpans = cfbUnnaturalTileFS; + break; + case FillStippled: + if (devPriv->pRotatedPixmap) + pGC->ops->FillSpans = cfb8Stipple32FS; + else + pGC->ops->FillSpans = cfbUnnaturalStippleFS; + break; + case FillOpaqueStippled: + if (devPriv->pRotatedPixmap) + pGC->ops->FillSpans = cfb8OpaqueStipple32FS; + else + pGC->ops->FillSpans = cfbUnnaturalStippleFS; + break; + default: + FatalError("CreatorValidateGC: illegal fillStyle\n"); + } + } /* end of new_fillspans */ + + if (new_fillarea) { + pGC->ops->PolyFillRect = cfbPolyFillRect; + pGC->ops->PolyFillArc = miPolyFillArc; + if (canGX) + pGC->ops->PolyFillRect = CreatorPolyFillRect; + pGC->ops->PushPixels = mfbPushPixels; + } +} + + + +GCFuncs CreatorGCFuncs = { + CreatorValidateGC, + miChangeGC, + miCopyGC, + miDestroyGC, + miChangeClip, + miDestroyClip, + miCopyClip +}; + + +Bool CreatorCreateGC (GCPtr pGC) +{ + CreatorPrivGCPtr gxPriv; + if (pGC->depth == 1) return mfbCreateGC (pGC); + if (! cfbCreateGC (pGC)) return FALSE; + + pGC->ops = & CreatorNonTEOps; + pGC->funcs = & CreatorGCFuncs; + gxPriv = CreatorGetGCPrivate (pGC); + gxPriv->type = DRAWABLE_WINDOW; + +#ifdef linux +#ifdef WriteBitGroup + gxPriv->PolyGlyphBlt = cfbImageGlyphBlt8; +#else + gxPriv->PolyGlyphBlt = miImageGlyphBlt; +#endif +#endif + + return TRUE; +} + + +#if NeedFunctionPrototypes +sunFFBAccelInit ( + ScreenPtr pScreen, + fbFd *fb) +#else +sunFFBAccelInit (pScreen, fb) + ScreenPtr pScreen; + fbFd *fb; +#endif +{ + unsigned int mode; + register long r; + CreatorPrivScreenPtr Priv; + + if (serverGeneration != CreatorGeneration) + { + CreatorScreenPrivateIndex = AllocateScreenPrivateIndex (); + if (CreatorScreenPrivateIndex == -1) return FALSE; + CreatorGCPrivateIndex = AllocateGCPrivateIndex (); + CreatorWindowPrivateIndex = AllocateWindowPrivateIndex (); + CreatorGeneration = serverGeneration; + } + + /* Allocate private structures holding pointer to both videoRAM and control registers. + We do not have to map these by ourselves, because the XServer did it for us; we + only copy the pointers to out structures. */ + if (! AllocateGCPrivate (pScreen, CreatorGCPrivateIndex, sizeof (CreatorPrivGCRec))) return FALSE; + if (! AllocateWindowPrivate(pScreen, CreatorWindowPrivateIndex, 0)) return FALSE; + pScreen->devPrivates [CreatorScreenPrivateIndex] .ptr = xalloc (sizeof (CreatorPrivGCRec)); + Priv = CreatorGetScreenPrivate (pScreen); + Priv->Registry = (ffb_fbcPtr) fb->private; + Priv->Pamet = (unsigned *) fb->fb; + + /* Replace various screen functions. All but the first are the default + versions. */ + pScreen->CreateGC = CreatorCreateGC; + pScreen->CreateWindow = cfbCreateWindow; + pScreen->ChangeWindowAttributes = cfbChangeWindowAttributes; + pScreen->DestroyWindow = cfbDestroyWindow; + pScreen->PaintWindowBackground = cfbPaintWindow; + pScreen->PaintWindowBorder = cfbPaintWindow; + pScreen->CopyWindow = cfbCopyWindow; + + /* We will now clear the screen: we'll draw a rectangle covering all the + viewscreen, using a 'blackness' ROP. */ + CREATOR_RECT_START (Priv->Registry, 0, ~0, 0); + CREATOR_RECT_BODY (Priv->Registry, 0, 0, fb->info.fb_width, fb->info.fb_height); + CREATOR_RECT_END (); + + /* Success */ + return TRUE; +} + --- XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunFFB.h.sparc Fri Sep 20 19:14:27 2002 +++ XFree86-3.3.6/xc/programs/Xserver/hw/sun/sunFFB.h Fri Sep 20 19:14:27 2002 @@ -0,0 +1,193 @@ +/* +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to 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. + + Acceleration for the Creator and Creator3D framebuffer - defines. + + Author: Michal "Hobit" Rehacek (majkl@iname.com) +*/ + +#define FFB_SFB8R_VOFF 0x00000000 +#define FFB_SFB8G_VOFF 0x00400000 +#define FFB_SFB8B_VOFF 0x00800000 +#define FFB_SFB8X_VOFF 0x00c00000 +#define FFB_SFB32_VOFF 0x01000000 +#define FFB_SFB64_VOFF 0x02000000 +#define FFB_FBC_REGS_VOFF 0x04000000 +#define FFB_BM_FBC_REGS_VOFF 0x04002000 +#define FFB_DFB8R_VOFF 0x04004000 +#define FFB_DFB8G_VOFF 0x04404000 +#define FFB_DFB8B_VOFF 0x04804000 +#define FFB_DFB8X_VOFF 0x04c04000 +#define FFB_DFB24_VOFF 0x05004000 +#define FFB_DFB32_VOFF 0x06004000 +#define FFB_DFB422A_VOFF 0x07004000 /* DFB 422 mode write to A */ +#define FFB_DFB422AD_VOFF 0x07804000 /* DFB 422 mode with line doubling */ +#define FFB_DFB24B_VOFF 0x08004000 /* DFB 24bit mode write to B */ +#define FFB_DFB422B_VOFF 0x09004000 /* DFB 422 mode write to B */ +#define FFB_DFB422BD_VOFF 0x09804000 /* DFB 422 mode with line doubling */ +#define FFB_SFB16Z_VOFF 0x0a004000 /* 16bit mode Z planes */ +#define FFB_SFB8Z_VOFF 0x0a404000 /* 8bit mode Z planes */ +#define FFB_SFB422_VOFF 0x0ac04000 /* SFB 422 mode write to A/B */ +#define FFB_SFB422D_VOFF 0x0b404000 /* SFB 422 mode with line doubling */ +#define FFB_FBC_KREGS_VOFF 0x0bc04000 +#define FFB_DAC_VOFF 0x0bc06000 +#define FFB_PROM_VOFF 0x0bc08000 +#define FFB_EXP_VOFF 0x0bc18000 + +#define FFB_SFB8R_POFF 0x04000000 +#define FFB_SFB8G_POFF 0x04400000 +#define FFB_SFB8B_POFF 0x04800000 +#define FFB_SFB8X_POFF 0x04c00000 +#define FFB_SFB32_POFF 0x05000000 +#define FFB_SFB64_POFF 0x06000000 +#define FFB_FBC_REGS_POFF 0x00600000 +#define FFB_BM_FBC_REGS_POFF 0x00600000 +#define FFB_DFB8R_POFF 0x01000000 +#define FFB_DFB8G_POFF 0x01400000 +#define FFB_DFB8B_POFF 0x01800000 +#define FFB_DFB8X_POFF 0x01c00000 +#define FFB_DFB24_POFF 0x02000000 +#define FFB_DFB32_POFF 0x03000000 +#define FFB_FBC_KREGS_POFF 0x00610000 +#define FFB_DAC_POFF 0x00400000 +#define FFB_PROM_POFF 0x00000000 +#define FFB_EXP_POFF 0x00200000 + +#define FFB_Y_BYTE_ADDR_SHIFT 11 +#define FFB_Y_ADDR_SHIFT 13 + +#define FFB_PPC_ACE_DISABLE 1 +#define FFB_PPC_ACE_AUX_ADD 3 +#define FFB_PPC_ACE_SHIFT 18 +#define FFB_PPC_DCE_DISABLE 2 +#define FFB_PPC_DCE_SHIFT 16 +#define FFB_PPC_ABE_DISABLE 2 +#define FFB_PPC_ABE_SHIFT 14 +#define FFB_PPC_VCE_DISABLE 1 +#define FFB_PPC_VCE_2D 2 +#define FFB_PPC_VCE_SHIFT 12 +#define FFB_PPC_APE_DISABLE 2 +#define FFB_PPC_APE_SHIFT 10 +#define FFB_PPC_CS_VARIABLE 2 +#define FFB_PPC_CS_SHIFT 0 + +#define FFB_FBC_WB_A 1 +#define FFB_FBC_WB_SHIFT 29 +#define FFB_FBC_PGE_MASK 3 +#define FFB_FBC_BE_SHIFT 4 +#define FFB_FBC_GE_SHIFT 2 +#define FFB_FBC_RE_SHIFT 0 + +#define FFB_ROP_NEW 0x83 +#define FFB_ROP_RGB_SHIFT 0 + +#define FFB_UCSR_FIFO_MASK 0xfff +#define FFB_UCSR_RP_BUSY 0x02000000 + + +typedef struct _ffb_fbc { + unsigned char xxx1[0x60]; + volatile unsigned int by; + volatile unsigned int bx; + unsigned int xxx2; + unsigned int xxx3; + volatile unsigned int bh; + volatile unsigned int bw; + unsigned char xxx4[0x188]; + volatile unsigned int ppc; + unsigned int xxx5; + volatile unsigned int fg; + volatile unsigned int bg; + unsigned char xxx6[0x44]; + volatile unsigned int fbc; + volatile unsigned int rop; + unsigned char xxx7[0x34]; + volatile unsigned int pmask; + unsigned char xxx8[12]; + volatile unsigned int clip0min; + volatile unsigned int clip0max; + volatile unsigned int clip1min; + volatile unsigned int clip1max; + volatile unsigned int clip2min; + volatile unsigned int clip2max; + volatile unsigned int clip3min; + volatile unsigned int clip3max; + unsigned char xxx9[0x3c]; + volatile unsigned int unk1; + volatile unsigned int unk2; + unsigned char xxx10[0x10]; + volatile unsigned int fontxy; + volatile unsigned int fontw; + volatile unsigned int fontinc; + volatile unsigned int font; + unsigned char xxx11[0x4dc]; + volatile unsigned int unk3; + unsigned char xxx12[0xfc]; + volatile unsigned int ucsr; +} ffb_fbc, * ffb_fbcPtr; + + +typedef struct _ffb_dac { + volatile unsigned int type; + volatile unsigned int value; + unsigned char xxx1[4]; + volatile unsigned int dev_id; +} ffb_dac, ffb_dacPtr; + + +typedef struct +{ + int type; + + void (* PolyGlyphBlt) ( +#if NeedNestedPrototypes + DrawablePtr /*pDrawable*/, + GCPtr /*pGC*/, + int /*x*/, + int /*y*/, + unsigned int /*nglyph*/, + CharInfoPtr * /*ppci*/, + pointer /*pglyphBase*/ +#endif + ); +} CreatorPrivGCRec, * CreatorPrivGCPtr; + + +typedef struct +{ + ffb_fbcPtr Registry; + unsigned * Pamet; +} CreatorPrivScreenRec, * CreatorPrivScreenPtr; + + +extern int CreatorScreenPrivateIndex; +extern int CreatorGCPrivateIndex; +extern int CreatorWindowPrivateIndex; + + +#define CreatorGetScreenPrivate(s) ((CreatorPrivScreenPtr) \ + (s)->devPrivates[CreatorScreenPrivateIndex].ptr) + + +#define CreatorGetGCPrivate(g) ((CreatorPrivGCPtr) \ + (g)->devPrivates [CreatorGCPrivateIndex].ptr) + --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c.sparc Tue Oct 12 18:07:03 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.c Fri Sep 20 19:14:30 2002 @@ -291,6 +291,7 @@ unsigned long ApertureBase; unsigned long IOBase; unsigned long RegisterBase; + unsigned long ROMBase; Bool BlockIO; } ATIPCIInformation; @@ -434,21 +435,24 @@ static ATIInformationBlock *GetATIInformationBlock(BlockIO) Bool BlockIO; { +#ifndef __sparc__ #define BIOS_DATA_SIZE 0x10000 char signature[] = " 761295520"; char bios_data[BIOS_DATA_SIZE]; char bios_signature[10]; #define sbios_data(_n) (*((CARD16 *)(bios_data + (_n)))) - int tmp,tmp2,i,j; - static ATIInformationBlock info = { 0, }; int ROM_Table_Offset; int Freq_Table_Ptr; int CDepth_Table_Ptr; int CTable_Size; int LCDTable; int LCDPanelInfo; +#endif /* __sparc__ */ + int tmp,tmp2,i,j; + static ATIInformationBlock info = { 0, }; - + +#ifndef __sparc__ if (xf86ReadBIOS(mach64InfoRec.BIOSbase, 0x30, (unsigned char *)bios_signature, 10) != 10) { return NULL; @@ -477,6 +481,10 @@ info.VGA_Wonder_Present = bios_data[ 0x44 ] & 0x40; +#else /* __sparc__ */ + info.VGA_Wonder_Present = 0; +#endif + info.Mach64_Present = 1; /* Test for Mach64 product */ tmp = inl(ioSCRATCH_REG0); @@ -681,7 +689,8 @@ } } - + +#ifndef __sparc__ ROM_Table_Offset = sbios_data(0x48); Freq_Table_Ptr = sbios_data(ROM_Table_Offset + 0x10); info.Clock_Type = bios_data[Freq_Table_Ptr]; @@ -805,6 +814,54 @@ info.LCDVertical = (bios_data[LCDPanelInfo + 0x1C] << 8) + bios_data[LCDPanelInfo + 0x1B]; +#else /* __sparc__ */ + + for (i = 0; i < MACH64_NUM_CLOCKS; i++) + info.Clocks[i] = 0; + + info.Freq_Table[0].h_disp = 0; + info.Freq_Table2[0].h_disp = 0; + + if (info.DAC_Type == DAC_INTERNAL) { + info.Clock_Type = CLK_INTERNAL; + info.CXClk = inl(ioCLOCK_CNTL) & 3; + outb(ioCLOCK_CNTL + 1, PLL_REF_DIV << 2); + info.RefDivider = inb(ioCLOCK_CNTL + 2); + info.NAdj = 1; + + info.RefFreq = 1432; + info.MinFreq = 16 * (2 * info.RefFreq) / info.RefDivider; + info.MaxFreq = 255 * (2 * info.RefFreq) / info.RefDivider; + + outb(ioCLOCK_CNTL + 1, MCLK_FB_DIV << 2); + info.DRAMMemClk = (info.RefFreq * inb(ioCLOCK_CNTL + 2)) / + info.RefDivider; + info.VRAMMemClk = info.DRAMMemClk; + info.MemClk = 4; + info.MemCycle = 0; + } else { + ErrorF("Mach64 probe: don't know how to handle DAC_Type %d\n", + info.DAC_Type); + info.Mach64_Present = 0; + return &info; + } + +#ifdef DEBUG + ErrorF("Clock Type: %d\n", info.Clock_Type); + ErrorF("Min Freq: %d\n", info.MinFreq); + ErrorF("Max Freq: %d\n", info.MaxFreq); + ErrorF("Ref Freq: %d\n", info.RefFreq); + ErrorF("Ref Divider: %d\n", info.RefDivider); + ErrorF("NAdj: %d\n", info.NAdj); + ErrorF("DRAMMemClk: %d\n", info.DRAMMemClk); + ErrorF("VRAMMemClk: %d\n", info.VRAMMemClk); + ErrorF("MemClk: %d\n", info.MemClk); + ErrorF("CXClk: %d\n", info.CXClk); + ErrorF("MemCycle: %d\n", info.MemCycle); +#endif + +#endif /* __sparc__ */ + return &info; } @@ -884,7 +941,7 @@ } else { info.RegisterBase = pcrp->_base2 & 0xFFFFF000; } - + info.ROMBase = pcrp->_baserom & 0xFFFF0000; /* * The docs say check (pcrp->_user_config_0 & 0x04) for BlockIO * but this doesn't seem to be reliable. Instead check if @@ -907,6 +964,7 @@ pcrp->_cardnum, pcrp->_func, PCI_REG_USERCONFIG, 0x04, 0x04); } +#if !defined(__sparc__) } else { info.BlockIO = FALSE; switch (pcrp->_user_config_0 & 0x03) { @@ -924,6 +982,9 @@ break; } } +#else + } +#endif /* !defined(__sparc__) */ break; } i++; @@ -1047,9 +1108,14 @@ static void InitIOAddresses(base, block) - unsigned base; + unsigned long base; Bool block; { +#if defined(__sparc__) + if (!block) + FatalError("InitIOAddresses: Sparce IO requested, can't handle on sparc\n"); + base = (unsigned long)xf86MapIOPorts(base, 0x100); +#endif if (block) { ioCONFIG_CHIP_ID = base + CONFIG_CHIP_ID; ioCONFIG_CNTL = base + CONFIG_CNTL; @@ -1112,11 +1178,20 @@ /* Do the general PCI probe first */ pciInfo = GetATIPCIInformation(); +#if defined(__sparc__) + if (pciInfo) { + mach64InfoRec.BIOSbase = pciInfo->ROMBase; + InitIOAddresses(pciInfo->IOBase, 1); + } else { + return FALSE; + } +#else if (pciInfo) { InitIOAddresses(pciInfo->IOBase, pciInfo->BlockIO); } else { InitIOAddresses(0x2EC, FALSE); } +#endif xf86ClearIOPortList(mach64InfoRec.scrnIndex); xf86AddIOPorts(mach64InfoRec.scrnIndex, Num_Mach64_IOPorts, Mach64_IOPorts); @@ -1439,6 +1514,10 @@ mach64InfoRec.chipset = "mach64"; xf86ProbeFailed = FALSE; +#ifdef __sparc__ + OFLG_SET(OPTION_OVERRIDE_BIOS, &mach64InfoRec.options); +#endif + if (mach64IntegratedController) { if (pciInfo) mach64BusType = PCI; @@ -1811,9 +1890,11 @@ if (!found && OFLG_ISSET(OPTION_OVERRIDE_BIOS, &mach64InfoRec.options)) { +#ifndef __sparc__ /* BIOS doesn't think this mode is legal! */ ErrorF("%s %s: Illegal mode according to Mach64 BIOS (Overridden)\n", XCONFIG_GIVEN, mach64InfoRec.name); +#endif found = TRUE; } --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.h.sparc Fri Jul 23 13:44:38 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64.h Fri Sep 20 19:14:36 2002 @@ -57,6 +57,8 @@ #include "regionstr.h" #include "regmach64.h" +#include "mach64util.h" + extern pointer mach64VideoMem; extern pointer vgaBase; extern Bool xf86VTSema; --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64fcach.c.sparc Tue May 25 11:35:01 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64fcach.c Fri Sep 20 19:14:40 2002 @@ -175,7 +175,11 @@ for (srcline=0; srcline < height; srcline++) { pword = *(int *)psrc; +#ifdef __sparc__ + for (srcbit=31; srcbit >= (32 - width); srcbit--) +#else for (srcbit=0; srcbit < width; srcbit++) +#endif { if (pword & (1L << srcbit)) tmpword |= (1L << dstbit); --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64frect.c.sparc Mon Dec 23 06:39:15 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64frect.c Fri Sep 20 19:14:43 2002 @@ -347,7 +347,9 @@ unsigned char pattern[8]; unsigned char rotated_pattern[8]; int i; +#ifndef __sparc__ extern unsigned char reverseByteOrder[]; +#endif adjLeftX = ((pGC->patOrg.x + drawableXOrg) & 0x07); adjTopY = ((pGC->patOrg.y + drawableYOrg) & 0x07); @@ -355,8 +357,10 @@ *((int *)&pattern[0]) = pci->pattern0; *((int *)&pattern[4]) = pci->pattern1; +#ifndef __sparc__ for (i=0; i<8; i++) pattern[i] = reverseByteOrder[pattern[i]]; +#endif /* rotate the pattern in the x direction */ for (i=0; i<8; i++) --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64im.c.sparc Wed Jun 2 11:41:15 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64im.c Fri Sep 20 19:14:44 2002 @@ -176,6 +176,7 @@ int alu; unsigned long planemask; { + int bpp = mach64InfoRec.bitsPerPixel; pointer curvm; int byteCount; @@ -199,7 +200,7 @@ byteCount = w * BytesPerPixel; while(h--) { - MemToBus((void *)curvm, psrc, byteCount); + memtobus((void *)curvm, psrc, byteCount, bpp); curvm = (pointer)((unsigned char *)curvm + screenStride); psrc += pwidth; } @@ -227,6 +228,7 @@ unsigned int reversed_pixmap[16]; int i; #endif + int bpp = mach64InfoRec.bitsPerPixel; WaitQueue(8); old_DP_PIX_WIDTH = regr(DP_PIX_WIDTH); @@ -235,7 +237,7 @@ regw(DP_WRITE_MASK, planemask); regw(DP_MIX, (alu << 16) | alu); regw(DP_SRC, (MONO_SRC_ONE | FRGD_SRC_HOST | BKGD_SRC_HOST)); - switch(mach64InfoRec.bitsPerPixel) + switch(bpp) { case 8: regw(DP_PIX_WIDTH, (SRC_8BPP | HOST_8BPP | DST_8BPP)); @@ -248,7 +250,13 @@ break; } - w = (w + 3) / 4; /* round up to int boundry */ + if (px & 3) { /* align down on int boundry */ + x -= px & 3; + w += px & 3; + px = px & ~(3); + } + + w = (w + 3) / 4; /* round up to int boundry */ regw(DST_Y_X, ((x << 16) | (y & 0x0000ffff))); regw(DST_HEIGHT_WIDTH, (((w * 4) << 16) | (h & 0x0000ffff))); @@ -422,45 +430,45 @@ while (count >= 16) { WaitQueue(16); - regw(HOST_DATAF, *pword++); - regw(HOST_DATAE, *pword++); - regw(HOST_DATAD, *pword++); - regw(HOST_DATAC, *pword++); - regw(HOST_DATAB, *pword++); - regw(HOST_DATAA, *pword++); - regw(HOST_DATA9, *pword++); - regw(HOST_DATA8, *pword++); - regw(HOST_DATA7, *pword++); - regw(HOST_DATA6, *pword++); - regw(HOST_DATA5, *pword++); - regw(HOST_DATA4, *pword++); - regw(HOST_DATA3, *pword++); - regw(HOST_DATA2, *pword++); - regw(HOST_DATA1, *pword++); - regw(HOST_DATA0, *pword++); + regw(HOST_DATAF, swap(*pword++, bpp)); + regw(HOST_DATAE, swap(*pword++, bpp)); + regw(HOST_DATAD, swap(*pword++, bpp)); + regw(HOST_DATAC, swap(*pword++, bpp)); + regw(HOST_DATAB, swap(*pword++, bpp)); + regw(HOST_DATAA, swap(*pword++, bpp)); + regw(HOST_DATA9, swap(*pword++, bpp)); + regw(HOST_DATA8, swap(*pword++, bpp)); + regw(HOST_DATA7, swap(*pword++, bpp)); + regw(HOST_DATA6, swap(*pword++, bpp)); + regw(HOST_DATA5, swap(*pword++, bpp)); + regw(HOST_DATA4, swap(*pword++, bpp)); + regw(HOST_DATA3, swap(*pword++, bpp)); + regw(HOST_DATA2, swap(*pword++, bpp)); + regw(HOST_DATA1, swap(*pword++, bpp)); + regw(HOST_DATA0, swap(*pword++, bpp)); count -= 16; } - WaitQueue(16); + WaitQueue(count); switch(count) { - case 15: regw(HOST_DATAE, *pword++); - case 14: regw(HOST_DATAD, *pword++); - case 13: regw(HOST_DATAC, *pword++); - case 12: regw(HOST_DATAB, *pword++); - case 11: regw(HOST_DATAA, *pword++); - case 10: regw(HOST_DATA9, *pword++); - case 9: regw(HOST_DATA8, *pword++); - case 8: regw(HOST_DATA7, *pword++); - case 7: regw(HOST_DATA6, *pword++); - case 6: regw(HOST_DATA5, *pword++); - case 5: regw(HOST_DATA4, *pword++); - case 4: regw(HOST_DATA3, *pword++); - case 3: regw(HOST_DATA2, *pword++); - case 2: regw(HOST_DATA1, *pword++); - case 1: regw(HOST_DATA0, *pword); - default: - break; + case 15: regw(HOST_DATAE, swap(*pword++, bpp)); + case 14: regw(HOST_DATAD, swap(*pword++, bpp)); + case 13: regw(HOST_DATAC, swap(*pword++, bpp)); + case 12: regw(HOST_DATAB, swap(*pword++, bpp)); + case 11: regw(HOST_DATAA, swap(*pword++, bpp)); + case 10: regw(HOST_DATA9, swap(*pword++, bpp)); + case 9: regw(HOST_DATA8, swap(*pword++, bpp)); + case 8: regw(HOST_DATA7, swap(*pword++, bpp)); + case 7: regw(HOST_DATA6, swap(*pword++, bpp)); + case 6: regw(HOST_DATA5, swap(*pword++, bpp)); + case 5: regw(HOST_DATA4, swap(*pword++, bpp)); + case 4: regw(HOST_DATA3, swap(*pword++, bpp)); + case 3: regw(HOST_DATA2, swap(*pword++, bpp)); + case 2: regw(HOST_DATA1, swap(*pword++, bpp)); + case 1: regw(HOST_DATA0, swap(*pword, bpp)); + default: + break; } psrc += pwidth; } @@ -487,7 +495,8 @@ int py; unsigned long planemask; { - int j; + int bpp = mach64InfoRec.bitsPerPixel; + int byteCount; pointer curvm; if ((w <= 0) || (h <= 0)) @@ -505,11 +514,13 @@ WaitIdleEmpty(); psrc += pwidth * py + px * BytesPerPixel; - curvm = (pointer)((unsigned char *)mach64VideoMem + x * BytesPerPixel); - - for (j = y; j < y+h; j++) { - BusToMem(psrc, (void *)((unsigned char *)curvm + j * screenStride), - w * BytesPerPixel); + curvm = (pointer)((unsigned char *)mach64VideoMem + + (x + y * mach64VirtX) * BytesPerPixel); + + byteCount = w * BytesPerPixel; + while (h--) { + bustomem(psrc, (void *)curvm, byteCount, bpp); + curvm = (pointer)((unsigned char *)curvm + screenStride); psrc += pwidth; } } @@ -542,6 +553,7 @@ unsigned int reversed_bitmap[16]; int i; #endif + int bpp = mach64InfoRec.bitsPerPixel; if (alu == MIX_DST || w <= 0 || h <= 0) return; @@ -562,7 +574,7 @@ else regw(DP_MIX, (alu << 16) | MIX_DST); - switch(mach64InfoRec.bitsPerPixel) + switch(bpp) { case 8: regw(DP_PIX_WIDTH, (BYTE_ORDER_LSB_TO_MSB | SRC_1BPP | HOST_1BPP | --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c.sparc Tue Oct 12 18:07:03 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64init.c Fri Sep 20 19:14:46 2002 @@ -45,8 +45,12 @@ /* Defaults for i386 */ #ifndef PAGE_SIZE +#ifdef __sparc__ +#define PAGE_SIZE 0x2000 +#else #define PAGE_SIZE 0x1000 #endif +#endif #ifndef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE-1)) #endif @@ -438,7 +442,7 @@ { char tmp; -#ifdef __alpha__ +#if defined(__alpha__) || defined(__sparc__) usleep(26); #else /* Delay for 26 us */ @@ -1749,6 +1753,9 @@ mach64MemReg = (pointer)((unsigned long)mach64MemRegMap + regoffset); } +#ifdef __sparc__ + apaddr += 0x800000; +#endif if (!mach64VideoMem) { mach64VideoMem = xf86MapVidMem(screen_idx, LINEAR_REGION, (pointer)apaddr, memsize); --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64util.c.sparc Mon Dec 23 06:39:29 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64util.c Fri Sep 20 19:14:48 2002 @@ -1,86 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach64/mach64util.c,v 3.5 1996/12/23 06:39:29 dawes Exp $ */ -/* - * Copyright 1994 by Kevin E. Martin, Chapel Hill, North Carolina. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, 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 Kevin E. Martin not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Kevin E. Martin makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * KEVIN E. MARTIN, RICKARD E. FAITH, AND TIAGO GONS DISCLAIM ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHORS - * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING - * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Modified for the Mach64 by Kevin E. Martin (martin@cs.unc.edu) - */ -/* $XConsortium: mach64util.c /main/5 1996/05/07 17:11:09 kaleb $ */ - -#include "X.h" -#include "input.h" -#include "regmach64.h" - -#ifdef __alpha__ -/* - * on the Alpha, there are "write buffers" that hold data to be written - * to memory; the data is *not* necessarily flushed to memory immediately. - * so, we use a "memory barrier" instruction to force the flush of these - * buffers, so that writing to the memory-mapped Mach64 registers *will* - * take place immediately. - */ -#define barrier() __asm__ __volatile__("mb": : :"memory") -#else /* __alpha__ */ -#define barrier() -#endif /* __alpha__ */ - -extern pointer mach64MemReg; - -__inline__ void regw(unsigned int regindex, unsigned long regdata) -{ - unsigned long appaddr; - - /* calculate aperture address */ - appaddr = (unsigned long)mach64MemReg + regindex; - - *(int *)appaddr = regdata; - barrier(); -} - -__inline__ unsigned long regr(unsigned int regindex) -{ - unsigned long appaddr; - - /* calculate aperture address */ - appaddr = (unsigned long)mach64MemReg + regindex; - - return (*(int *)appaddr); -} - -__inline__ void regwb(unsigned int regindex, unsigned char regdata) -{ - unsigned long appaddr; - - /* calculate aperture address */ - appaddr = (unsigned long)mach64MemReg + regindex; - - *(char *)appaddr = regdata; - barrier(); -} - -__inline__ unsigned char regrb(unsigned int regindex) -{ - unsigned long appaddr; - - /* calculate aperture address */ - appaddr = (unsigned long)mach64MemReg + regindex; - - return (*(char *)appaddr); -} --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64util.h.sparc Fri Sep 20 19:14:50 2002 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64util.h Fri Sep 20 19:14:50 2002 @@ -0,0 +1,221 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/accel/mach64/mach64util.h,v 3.5 1996/12/23 06:39:29 dawes Exp $ */ +/* + * Copyright 1994 by Kevin E. Martin, Chapel Hill, North Carolina. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, 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 Kevin E. Martin not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Kevin E. Martin makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * KEVIN E. MARTIN, RICKARD E. FAITH, AND TIAGO GONS DISCLAIM ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL THE AUTHORS + * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY + * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER + * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING + * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Modified for the Mach64 by Kevin E. Martin (martin@cs.unc.edu) + */ +/* $XConsortium: mach64util.h /main/5 1996/05/07 17:11:09 kaleb $ */ + +#include "X.h" +#include "input.h" +#include "regmach64.h" + +#ifdef __alpha__ +/* + * on the Alpha, there are "write buffers" that hold data to be written + * to memory; the data is *not* necessarily flushed to memory immediately. + * so, we use a "memory barrier" instruction to force the flush of these + * buffers, so that writing to the memory-mapped Mach64 registers *will* + * take place immediately. + */ +#define barrier() __asm__ __volatile__("mb": : :"memory") +#else /* __alpha__ */ +#ifdef __sparc__ +#define barrier() __asm__ __volatile__(".word 0x8143e00a": : :"memory") +#else /* __sparc__ */ +#define barrier() +#endif /* __sparc__ */ +#endif /* __alpha__ */ + +extern pointer mach64MemReg; + +#ifdef __sparc__ + +#define ASI_PL 0x88 + +extern __inline__ unsigned int swap(unsigned int bits, int bpp) +{ + unsigned int ret = 0; + int i; + + switch (bpp) { + case 8: + default: + ret = (((bits >> 24) & 0xff) << 0) | + (((bits >> 16) & 0xff) << 8) | + (((bits >> 8) & 0xff) << 16) | + (((bits >> 0) & 0xff) << 24); + break; + case 16: + ret = (((bits >> 16) & 0xffff) << 0) | + (((bits >> 0) & 0xffff) << 16); + break; + case 32: + ret = bits; + break; + } + return ret; +} + +extern __inline__ unsigned int swapb(unsigned int bits) +{ + extern unsigned char reverseByteOrder[]; + + return (reverseByteOrder[(bits >> 24) & 0xff] << 0) | + (reverseByteOrder[(bits >> 16) & 0xff] << 8) | + (reverseByteOrder[(bits >> 8) & 0xff] << 16) | + (reverseByteOrder[(bits >> 0) & 0xff] << 24); +} + +static __inline void +memcpy8(unsigned char *dst, const unsigned char *src, unsigned int cnt) +{ + while (cnt--) + *dst++ = *src++; +} + +static __inline void +memcpy16(unsigned short *dst, const unsigned short *src, unsigned int cnt) +{ + unsigned int c = (cnt >> 1); + + while (c--) + *dst++ = *src++; +} + +static __inline void +memcpy32(unsigned int *dst, const unsigned int *src, unsigned int cnt) +{ + unsigned int c = (cnt >> 2); + + while (c--) + *dst++ = *src++; +} + +static __inline__ void +memtobus(void *dst, const void *src, unsigned int cnt, int bpp) +{ + switch (bpp) { + case 8: + default: + memcpy8(dst, src, cnt); + break; + case 16: + memcpy16(dst, src, cnt); + break; + case 32: + memcpy32(dst, src, cnt); + break; + } +} + +static __inline__ void +bustomem(void *dst, const void *src, unsigned int cnt, int bpp) +{ + switch (bpp) { + case 8: + default: + memcpy8(dst, src, cnt); + break; + case 16: + memcpy16(dst, src, cnt); + break; + case 32: + memcpy32(dst, src, cnt); + break; + } +} + +#else /* __sparc__ */ + +#define swap(bits,bpp) bits +#define swapb(bits) bits + +#define memtobus(dst,src,cnt,bpp) MemToBus(dst,src,cnt) +#define bustomem(dst,src,cnt,bpp) BusToMem(dst,src,cnt) + +#endif /* __sparc__ */ + +extern __inline__ void regw(unsigned int regindex, unsigned long regdata) +{ + unsigned long appaddr; + + /* calculate aperture address */ + appaddr = (unsigned long)mach64MemReg + regindex; + +#ifdef __sparc__ + __asm__ __volatile__("sta %0, [%1] %2" :: "r" (regdata), "r" (appaddr), "i" (ASI_PL)); +#else + *(__volatile__ int *)appaddr = regdata; +#endif + barrier(); +} + +extern __inline__ unsigned long regr(unsigned int regindex) +{ + unsigned long appaddr; +#ifdef __sparc__ + unsigned int ret; +#endif + + /* calculate aperture address */ + appaddr = (unsigned long)mach64MemReg + regindex; + +#ifdef __sparc__ + __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (appaddr), "i" (ASI_PL)); + return ret; +#else + return (*(__volatile__ int *)appaddr); +#endif +} + +extern __inline__ void regwb(unsigned int regindex, unsigned char regdata) +{ + unsigned long appaddr; + + /* calculate aperture address */ + appaddr = (unsigned long)mach64MemReg + regindex; + +#ifdef __sparc__ + __asm__ __volatile__("stba %0, [%1] %2" :: "r" (regdata), "r" (appaddr), "i" (ASI_PL)); +#else + *(__volatile__ char *)appaddr = regdata; +#endif + barrier(); +} + +extern __inline__ unsigned char regrb(unsigned int regindex) +{ + unsigned long appaddr; +#ifdef __sparc__ + unsigned char ret; +#endif + + /* calculate aperture address */ + appaddr = (unsigned long)mach64MemReg + regindex; + +#ifdef __sparc__ + __asm__ __volatile__("lduba [%1] %2, %0" : "=r" (ret) : "r" (appaddr), "i" (ASI_PL)); + return ret; +#else + return (*(__volatile__ char *)appaddr); +#endif +} --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/ativga.c.sparc Mon Oct 19 20:39:07 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/ativga.c Fri Sep 20 19:14:51 2002 @@ -107,6 +107,10 @@ unsigned char b2_save; unsigned char b8_save; +#if defined(__sparc__) + return; +#endif + if (!vgaBase) { vgaBase = xf86MapVidMem(screen_idx, VGA_REGION, (pointer)0xa0000, 64 * 1024); @@ -158,6 +162,10 @@ /* This routine is mostly from ATIRestore() in * xf86/vga256/drivers/ati/driver.c */ + +#if defined(__sparc__) + return; +#endif if (!mach64IntegratedController) { /* Unlock ATI specials */ --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64curs.c.sparc Sat May 31 13:34:38 1997 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64curs.c Fri Sep 20 19:14:53 2002 @@ -77,77 +77,152 @@ mach64MoveCursor, }; +#ifdef __sparc__ + unsigned short cursor_lookup[256] = { - 0x0000, 0x0001, 0x0004, 0x0005, 0x0010, 0x0011, 0x0014, 0x0015, - 0x0040, 0x0041, 0x0044, 0x0045, 0x0050, 0x0051, 0x0054, 0x0055, - 0x0100, 0x0101, 0x0104, 0x0105, 0x0110, 0x0111, 0x0114, 0x0115, - 0x0140, 0x0141, 0x0144, 0x0145, 0x0150, 0x0151, 0x0154, 0x0155, - 0x0400, 0x0401, 0x0404, 0x0405, 0x0410, 0x0411, 0x0414, 0x0415, - 0x0440, 0x0441, 0x0444, 0x0445, 0x0450, 0x0451, 0x0454, 0x0455, - 0x0500, 0x0501, 0x0504, 0x0505, 0x0510, 0x0511, 0x0514, 0x0515, - 0x0540, 0x0541, 0x0544, 0x0545, 0x0550, 0x0551, 0x0554, 0x0555, - 0x1000, 0x1001, 0x1004, 0x1005, 0x1010, 0x1011, 0x1014, 0x1015, - 0x1040, 0x1041, 0x1044, 0x1045, 0x1050, 0x1051, 0x1054, 0x1055, - 0x1100, 0x1101, 0x1104, 0x1105, 0x1110, 0x1111, 0x1114, 0x1115, - 0x1140, 0x1141, 0x1144, 0x1145, 0x1150, 0x1151, 0x1154, 0x1155, - 0x1400, 0x1401, 0x1404, 0x1405, 0x1410, 0x1411, 0x1414, 0x1415, - 0x1440, 0x1441, 0x1444, 0x1445, 0x1450, 0x1451, 0x1454, 0x1455, - 0x1500, 0x1501, 0x1504, 0x1505, 0x1510, 0x1511, 0x1514, 0x1515, - 0x1540, 0x1541, 0x1544, 0x1545, 0x1550, 0x1551, 0x1554, 0x1555, - 0x4000, 0x4001, 0x4004, 0x4005, 0x4010, 0x4011, 0x4014, 0x4015, - 0x4040, 0x4041, 0x4044, 0x4045, 0x4050, 0x4051, 0x4054, 0x4055, - 0x4100, 0x4101, 0x4104, 0x4105, 0x4110, 0x4111, 0x4114, 0x4115, - 0x4140, 0x4141, 0x4144, 0x4145, 0x4150, 0x4151, 0x4154, 0x4155, - 0x4400, 0x4401, 0x4404, 0x4405, 0x4410, 0x4411, 0x4414, 0x4415, - 0x4440, 0x4441, 0x4444, 0x4445, 0x4450, 0x4451, 0x4454, 0x4455, - 0x4500, 0x4501, 0x4504, 0x4505, 0x4510, 0x4511, 0x4514, 0x4515, - 0x4540, 0x4541, 0x4544, 0x4545, 0x4550, 0x4551, 0x4554, 0x4555, - 0x5000, 0x5001, 0x5004, 0x5005, 0x5010, 0x5011, 0x5014, 0x5015, - 0x5040, 0x5041, 0x5044, 0x5045, 0x5050, 0x5051, 0x5054, 0x5055, - 0x5100, 0x5101, 0x5104, 0x5105, 0x5110, 0x5111, 0x5114, 0x5115, - 0x5140, 0x5141, 0x5144, 0x5145, 0x5150, 0x5151, 0x5154, 0x5155, - 0x5400, 0x5401, 0x5404, 0x5405, 0x5410, 0x5411, 0x5414, 0x5415, - 0x5440, 0x5441, 0x5444, 0x5445, 0x5450, 0x5451, 0x5454, 0x5455, - 0x5500, 0x5501, 0x5504, 0x5505, 0x5510, 0x5511, 0x5514, 0x5515, - 0x5540, 0x5541, 0x5544, 0x5545, 0x5550, 0x5551, 0x5554, 0x5555 + 0x0000, 0x4000, 0x1000, 0x5000, 0x0400, 0x4400, 0x1400, 0x5400, + 0x0100, 0x4100, 0x1100, 0x5100, 0x0500, 0x4500, 0x1500, 0x5500, + 0x0040, 0x4040, 0x1040, 0x5040, 0x0440, 0x4440, 0x1440, 0x5440, + 0x0140, 0x4140, 0x1140, 0x5140, 0x0540, 0x4540, 0x1540, 0x5540, + 0x0010, 0x4010, 0x1010, 0x5010, 0x0410, 0x4410, 0x1410, 0x5410, + 0x0110, 0x4110, 0x1110, 0x5110, 0x0510, 0x4510, 0x1510, 0x5510, + 0x0050, 0x4050, 0x1050, 0x5050, 0x0450, 0x4450, 0x1450, 0x5450, + 0x0150, 0x4150, 0x1150, 0x5150, 0x0550, 0x4550, 0x1550, 0x5550, + 0x0004, 0x4004, 0x1004, 0x5004, 0x0404, 0x4404, 0x1404, 0x5404, + 0x0104, 0x4104, 0x1104, 0x5104, 0x0504, 0x4504, 0x1504, 0x5504, + 0x0044, 0x4044, 0x1044, 0x5044, 0x0444, 0x4444, 0x1444, 0x5444, + 0x0144, 0x4144, 0x1144, 0x5144, 0x0544, 0x4544, 0x1544, 0x5544, + 0x0014, 0x4014, 0x1014, 0x5014, 0x0414, 0x4414, 0x1414, 0x5414, + 0x0114, 0x4114, 0x1114, 0x5114, 0x0514, 0x4514, 0x1514, 0x5514, + 0x0054, 0x4054, 0x1054, 0x5054, 0x0454, 0x4454, 0x1454, 0x5454, + 0x0154, 0x4154, 0x1154, 0x5154, 0x0554, 0x4554, 0x1554, 0x5554, + 0x0001, 0x4001, 0x1001, 0x5001, 0x0401, 0x4401, 0x1401, 0x5401, + 0x0101, 0x4101, 0x1101, 0x5101, 0x0501, 0x4501, 0x1501, 0x5501, + 0x0041, 0x4041, 0x1041, 0x5041, 0x0441, 0x4441, 0x1441, 0x5441, + 0x0141, 0x4141, 0x1141, 0x5141, 0x0541, 0x4541, 0x1541, 0x5541, + 0x0011, 0x4011, 0x1011, 0x5011, 0x0411, 0x4411, 0x1411, 0x5411, + 0x0111, 0x4111, 0x1111, 0x5111, 0x0511, 0x4511, 0x1511, 0x5511, + 0x0051, 0x4051, 0x1051, 0x5051, 0x0451, 0x4451, 0x1451, 0x5451, + 0x0151, 0x4151, 0x1151, 0x5151, 0x0551, 0x4551, 0x1551, 0x5551, + 0x0005, 0x4005, 0x1005, 0x5005, 0x0405, 0x4405, 0x1405, 0x5405, + 0x0105, 0x4105, 0x1105, 0x5105, 0x0505, 0x4505, 0x1505, 0x5505, + 0x0045, 0x4045, 0x1045, 0x5045, 0x0445, 0x4445, 0x1445, 0x5445, + 0x0145, 0x4145, 0x1145, 0x5145, 0x0545, 0x4545, 0x1545, 0x5545, + 0x0015, 0x4015, 0x1015, 0x5015, 0x0415, 0x4415, 0x1415, 0x5415, + 0x0115, 0x4115, 0x1115, 0x5115, 0x0515, 0x4515, 0x1515, 0x5515, + 0x0055, 0x4055, 0x1055, 0x5055, 0x0455, 0x4455, 0x1455, 0x5455, + 0x0155, 0x4155, 0x1155, 0x5155, 0x0555, 0x4555, 0x1555, 0x5555 +}; + +unsigned short cursor_mask[256] = { + 0xaaaa, 0x2aaa, 0x8aaa, 0x0aaa, 0xa2aa, 0x22aa, 0x82aa, 0x02aa, + 0xa8aa, 0x28aa, 0x88aa, 0x08aa, 0xa0aa, 0x20aa, 0x80aa, 0x00aa, + 0xaa2a, 0x2a2a, 0x8a2a, 0x0a2a, 0xa22a, 0x222a, 0x822a, 0x022a, + 0xa82a, 0x282a, 0x882a, 0x082a, 0xa02a, 0x202a, 0x802a, 0x002a, + 0xaa8a, 0x2a8a, 0x8a8a, 0x0a8a, 0xa28a, 0x228a, 0x828a, 0x028a, + 0xa88a, 0x288a, 0x888a, 0x088a, 0xa08a, 0x208a, 0x808a, 0x008a, + 0xaa0a, 0x2a0a, 0x8a0a, 0x0a0a, 0xa20a, 0x220a, 0x820a, 0x020a, + 0xa80a, 0x280a, 0x880a, 0x080a, 0xa00a, 0x200a, 0x800a, 0x000a, + 0xaaa2, 0x2aa2, 0x8aa2, 0x0aa2, 0xa2a2, 0x22a2, 0x82a2, 0x02a2, + 0xa8a2, 0x28a2, 0x88a2, 0x08a2, 0xa0a2, 0x20a2, 0x80a2, 0x00a2, + 0xaa22, 0x2a22, 0x8a22, 0x0a22, 0xa222, 0x2222, 0x8222, 0x0222, + 0xa822, 0x2822, 0x8822, 0x0822, 0xa022, 0x2022, 0x8022, 0x0022, + 0xaa82, 0x2a82, 0x8a82, 0x0a82, 0xa282, 0x2282, 0x8282, 0x0282, + 0xa882, 0x2882, 0x8882, 0x0882, 0xa082, 0x2082, 0x8082, 0x0082, + 0xaa02, 0x2a02, 0x8a02, 0x0a02, 0xa202, 0x2202, 0x8202, 0x0202, + 0xa802, 0x2802, 0x8802, 0x0802, 0xa002, 0x2002, 0x8002, 0x0002, + 0xaaa8, 0x2aa8, 0x8aa8, 0x0aa8, 0xa2a8, 0x22a8, 0x82a8, 0x02a8, + 0xa8a8, 0x28a8, 0x88a8, 0x08a8, 0xa0a8, 0x20a8, 0x80a8, 0x00a8, + 0xaa28, 0x2a28, 0x8a28, 0x0a28, 0xa228, 0x2228, 0x8228, 0x0228, + 0xa828, 0x2828, 0x8828, 0x0828, 0xa028, 0x2028, 0x8028, 0x0028, + 0xaa88, 0x2a88, 0x8a88, 0x0a88, 0xa288, 0x2288, 0x8288, 0x0288, + 0xa888, 0x2888, 0x8888, 0x0888, 0xa088, 0x2088, 0x8088, 0x0088, + 0xaa08, 0x2a08, 0x8a08, 0x0a08, 0xa208, 0x2208, 0x8208, 0x0208, + 0xa808, 0x2808, 0x8808, 0x0808, 0xa008, 0x2008, 0x8008, 0x0008, + 0xaaa0, 0x2aa0, 0x8aa0, 0x0aa0, 0xa2a0, 0x22a0, 0x82a0, 0x02a0, + 0xa8a0, 0x28a0, 0x88a0, 0x08a0, 0xa0a0, 0x20a0, 0x80a0, 0x00a0, + 0xaa20, 0x2a20, 0x8a20, 0x0a20, 0xa220, 0x2220, 0x8220, 0x0220, + 0xa820, 0x2820, 0x8820, 0x0820, 0xa020, 0x2020, 0x8020, 0x0020, + 0xaa80, 0x2a80, 0x8a80, 0x0a80, 0xa280, 0x2280, 0x8280, 0x0280, + 0xa880, 0x2880, 0x8880, 0x0880, 0xa080, 0x2080, 0x8080, 0x0080, + 0xaa00, 0x2a00, 0x8a00, 0x0a00, 0xa200, 0x2200, 0x8200, 0x0200, + 0xa800, 0x2800, 0x8800, 0x0800, 0xa000, 0x2000, 0x8000, 0x0000, }; +#else /* __sparc__ */ + +unsigned short cursor_lookup[256] = { + 0x0000, 0x0001, 0x0004, 0x0005, 0x0010, 0x0011, 0x0014, 0x0015, + 0x0040, 0x0041, 0x0044, 0x0045, 0x0050, 0x0051, 0x0054, 0x0055, + 0x0100, 0x0101, 0x0104, 0x0105, 0x0110, 0x0111, 0x0114, 0x0115, + 0x0140, 0x0141, 0x0144, 0x0145, 0x0150, 0x0151, 0x0154, 0x0155, + 0x0400, 0x0401, 0x0404, 0x0405, 0x0410, 0x0411, 0x0414, 0x0415, + 0x0440, 0x0441, 0x0444, 0x0445, 0x0450, 0x0451, 0x0454, 0x0455, + 0x0500, 0x0501, 0x0504, 0x0505, 0x0510, 0x0511, 0x0514, 0x0515, + 0x0540, 0x0541, 0x0544, 0x0545, 0x0550, 0x0551, 0x0554, 0x0555, + 0x1000, 0x1001, 0x1004, 0x1005, 0x1010, 0x1011, 0x1014, 0x1015, + 0x1040, 0x1041, 0x1044, 0x1045, 0x1050, 0x1051, 0x1054, 0x1055, + 0x1100, 0x1101, 0x1104, 0x1105, 0x1110, 0x1111, 0x1114, 0x1115, + 0x1140, 0x1141, 0x1144, 0x1145, 0x1150, 0x1151, 0x1154, 0x1155, + 0x1400, 0x1401, 0x1404, 0x1405, 0x1410, 0x1411, 0x1414, 0x1415, + 0x1440, 0x1441, 0x1444, 0x1445, 0x1450, 0x1451, 0x1454, 0x1455, + 0x1500, 0x1501, 0x1504, 0x1505, 0x1510, 0x1511, 0x1514, 0x1515, + 0x1540, 0x1541, 0x1544, 0x1545, 0x1550, 0x1551, 0x1554, 0x1555, + 0x4000, 0x4001, 0x4004, 0x4005, 0x4010, 0x4011, 0x4014, 0x4015, + 0x4040, 0x4041, 0x4044, 0x4045, 0x4050, 0x4051, 0x4054, 0x4055, + 0x4100, 0x4101, 0x4104, 0x4105, 0x4110, 0x4111, 0x4114, 0x4115, + 0x4140, 0x4141, 0x4144, 0x4145, 0x4150, 0x4151, 0x4154, 0x4155, + 0x4400, 0x4401, 0x4404, 0x4405, 0x4410, 0x4411, 0x4414, 0x4415, + 0x4440, 0x4441, 0x4444, 0x4445, 0x4450, 0x4451, 0x4454, 0x4455, + 0x4500, 0x4501, 0x4504, 0x4505, 0x4510, 0x4511, 0x4514, 0x4515, + 0x4540, 0x4541, 0x4544, 0x4545, 0x4550, 0x4551, 0x4554, 0x4555, + 0x5000, 0x5001, 0x5004, 0x5005, 0x5010, 0x5011, 0x5014, 0x5015, + 0x5040, 0x5041, 0x5044, 0x5045, 0x5050, 0x5051, 0x5054, 0x5055, + 0x5100, 0x5101, 0x5104, 0x5105, 0x5110, 0x5111, 0x5114, 0x5115, + 0x5140, 0x5141, 0x5144, 0x5145, 0x5150, 0x5151, 0x5154, 0x5155, + 0x5400, 0x5401, 0x5404, 0x5405, 0x5410, 0x5411, 0x5414, 0x5415, + 0x5440, 0x5441, 0x5444, 0x5445, 0x5450, 0x5451, 0x5454, 0x5455, + 0x5500, 0x5501, 0x5504, 0x5505, 0x5510, 0x5511, 0x5514, 0x5515, + 0x5540, 0x5541, 0x5544, 0x5545, 0x5550, 0x5551, 0x5554, 0x5555 +}; unsigned short cursor_mask[256] = { - 0xaaaa, 0xaaa8, 0xaaa2, 0xaaa0, 0xaa8a, 0xaa88, 0xaa82, 0xaa80, - 0xaa2a, 0xaa28, 0xaa22, 0xaa20, 0xaa0a, 0xaa08, 0xaa02, 0xaa00, - 0xa8aa, 0xa8a8, 0xa8a2, 0xa8a0, 0xa88a, 0xa888, 0xa882, 0xa880, - 0xa82a, 0xa828, 0xa822, 0xa820, 0xa80a, 0xa808, 0xa802, 0xa800, - 0xa2aa, 0xa2a8, 0xa2a2, 0xa2a0, 0xa28a, 0xa288, 0xa282, 0xa280, - 0xa22a, 0xa228, 0xa222, 0xa220, 0xa20a, 0xa208, 0xa202, 0xa200, - 0xa0aa, 0xa0a8, 0xa0a2, 0xa0a0, 0xa08a, 0xa088, 0xa082, 0xa080, - 0xa02a, 0xa028, 0xa022, 0xa020, 0xa00a, 0xa008, 0xa002, 0xa000, - 0x8aaa, 0x8aa8, 0x8aa2, 0x8aa0, 0x8a8a, 0x8a88, 0x8a82, 0x8a80, - 0x8a2a, 0x8a28, 0x8a22, 0x8a20, 0x8a0a, 0x8a08, 0x8a02, 0x8a00, - 0x88aa, 0x88a8, 0x88a2, 0x88a0, 0x888a, 0x8888, 0x8882, 0x8880, - 0x882a, 0x8828, 0x8822, 0x8820, 0x880a, 0x8808, 0x8802, 0x8800, - 0x82aa, 0x82a8, 0x82a2, 0x82a0, 0x828a, 0x8288, 0x8282, 0x8280, - 0x822a, 0x8228, 0x8222, 0x8220, 0x820a, 0x8208, 0x8202, 0x8200, - 0x80aa, 0x80a8, 0x80a2, 0x80a0, 0x808a, 0x8088, 0x8082, 0x8080, - 0x802a, 0x8028, 0x8022, 0x8020, 0x800a, 0x8008, 0x8002, 0x8000, - 0x2aaa, 0x2aa8, 0x2aa2, 0x2aa0, 0x2a8a, 0x2a88, 0x2a82, 0x2a80, - 0x2a2a, 0x2a28, 0x2a22, 0x2a20, 0x2a0a, 0x2a08, 0x2a02, 0x2a00, - 0x28aa, 0x28a8, 0x28a2, 0x28a0, 0x288a, 0x2888, 0x2882, 0x2880, - 0x282a, 0x2828, 0x2822, 0x2820, 0x280a, 0x2808, 0x2802, 0x2800, - 0x22aa, 0x22a8, 0x22a2, 0x22a0, 0x228a, 0x2288, 0x2282, 0x2280, - 0x222a, 0x2228, 0x2222, 0x2220, 0x220a, 0x2208, 0x2202, 0x2200, - 0x20aa, 0x20a8, 0x20a2, 0x20a0, 0x208a, 0x2088, 0x2082, 0x2080, - 0x202a, 0x2028, 0x2022, 0x2020, 0x200a, 0x2008, 0x2002, 0x2000, - 0x0aaa, 0x0aa8, 0x0aa2, 0x0aa0, 0x0a8a, 0x0a88, 0x0a82, 0x0a80, - 0x0a2a, 0x0a28, 0x0a22, 0x0a20, 0x0a0a, 0x0a08, 0x0a02, 0x0a00, - 0x08aa, 0x08a8, 0x08a2, 0x08a0, 0x088a, 0x0888, 0x0882, 0x0880, - 0x082a, 0x0828, 0x0822, 0x0820, 0x080a, 0x0808, 0x0802, 0x0800, - 0x02aa, 0x02a8, 0x02a2, 0x02a0, 0x028a, 0x0288, 0x0282, 0x0280, - 0x022a, 0x0228, 0x0222, 0x0220, 0x020a, 0x0208, 0x0202, 0x0200, - 0x00aa, 0x00a8, 0x00a2, 0x00a0, 0x008a, 0x0088, 0x0082, 0x0080, - 0x002a, 0x0028, 0x0022, 0x0020, 0x000a, 0x0008, 0x0002, 0x0000, + 0xaaaa, 0xaaa8, 0xaaa2, 0xaaa0, 0xaa8a, 0xaa88, 0xaa82, 0xaa80, + 0xaa2a, 0xaa28, 0xaa22, 0xaa20, 0xaa0a, 0xaa08, 0xaa02, 0xaa00, + 0xa8aa, 0xa8a8, 0xa8a2, 0xa8a0, 0xa88a, 0xa888, 0xa882, 0xa880, + 0xa82a, 0xa828, 0xa822, 0xa820, 0xa80a, 0xa808, 0xa802, 0xa800, + 0xa2aa, 0xa2a8, 0xa2a2, 0xa2a0, 0xa28a, 0xa288, 0xa282, 0xa280, + 0xa22a, 0xa228, 0xa222, 0xa220, 0xa20a, 0xa208, 0xa202, 0xa200, + 0xa0aa, 0xa0a8, 0xa0a2, 0xa0a0, 0xa08a, 0xa088, 0xa082, 0xa080, + 0xa02a, 0xa028, 0xa022, 0xa020, 0xa00a, 0xa008, 0xa002, 0xa000, + 0x8aaa, 0x8aa8, 0x8aa2, 0x8aa0, 0x8a8a, 0x8a88, 0x8a82, 0x8a80, + 0x8a2a, 0x8a28, 0x8a22, 0x8a20, 0x8a0a, 0x8a08, 0x8a02, 0x8a00, + 0x88aa, 0x88a8, 0x88a2, 0x88a0, 0x888a, 0x8888, 0x8882, 0x8880, + 0x882a, 0x8828, 0x8822, 0x8820, 0x880a, 0x8808, 0x8802, 0x8800, + 0x82aa, 0x82a8, 0x82a2, 0x82a0, 0x828a, 0x8288, 0x8282, 0x8280, + 0x822a, 0x8228, 0x8222, 0x8220, 0x820a, 0x8208, 0x8202, 0x8200, + 0x80aa, 0x80a8, 0x80a2, 0x80a0, 0x808a, 0x8088, 0x8082, 0x8080, + 0x802a, 0x8028, 0x8022, 0x8020, 0x800a, 0x8008, 0x8002, 0x8000, + 0x2aaa, 0x2aa8, 0x2aa2, 0x2aa0, 0x2a8a, 0x2a88, 0x2a82, 0x2a80, + 0x2a2a, 0x2a28, 0x2a22, 0x2a20, 0x2a0a, 0x2a08, 0x2a02, 0x2a00, + 0x28aa, 0x28a8, 0x28a2, 0x28a0, 0x288a, 0x2888, 0x2882, 0x2880, + 0x282a, 0x2828, 0x2822, 0x2820, 0x280a, 0x2808, 0x2802, 0x2800, + 0x22aa, 0x22a8, 0x22a2, 0x22a0, 0x228a, 0x2288, 0x2282, 0x2280, + 0x222a, 0x2228, 0x2222, 0x2220, 0x220a, 0x2208, 0x2202, 0x2200, + 0x20aa, 0x20a8, 0x20a2, 0x20a0, 0x208a, 0x2088, 0x2082, 0x2080, + 0x202a, 0x2028, 0x2022, 0x2020, 0x200a, 0x2008, 0x2002, 0x2000, + 0x0aaa, 0x0aa8, 0x0aa2, 0x0aa0, 0x0a8a, 0x0a88, 0x0a82, 0x0a80, + 0x0a2a, 0x0a28, 0x0a22, 0x0a20, 0x0a0a, 0x0a08, 0x0a02, 0x0a00, + 0x08aa, 0x08a8, 0x08a2, 0x08a0, 0x088a, 0x0888, 0x0882, 0x0880, + 0x082a, 0x0828, 0x0822, 0x0820, 0x080a, 0x0808, 0x0802, 0x0800, + 0x02aa, 0x02a8, 0x02a2, 0x02a0, 0x028a, 0x0288, 0x0282, 0x0280, + 0x022a, 0x0228, 0x0222, 0x0220, 0x020a, 0x0208, 0x0202, 0x0200, + 0x00aa, 0x00a8, 0x00a2, 0x00a0, 0x008a, 0x0088, 0x0082, 0x0080, + 0x002a, 0x0028, 0x0022, 0x0020, 0x000a, 0x0008, 0x0002, 0x0000, }; +#endif /* __sparc__ */ + Bool checkCursorColor = FALSE; Bool @@ -267,7 +342,7 @@ for (i = 0; i < 1024; i++) mach64P_RGB514Index(0x100 + i, data[i]); else - MemToBus(mach64CursorMemory, cursPriv->data, MACH64_CURSBYTES); + memtobus(mach64CursorMemory, cursPriv->data, MACH64_CURSBYTES, 16); mach64CursYExtra = cursPriv->yExtra; mach64MoveCursor(0, x, y); --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/Imakefile.sparc Sun Jan 5 11:53:36 1997 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/Imakefile Fri Sep 20 19:14:55 2002 @@ -13,13 +13,13 @@ mach64fcach.c mach64fifo.c mach64font.c mach64frect.c mach64fs.c \ mach64gc.c mach64im.c mach64init.c mach64line.c mach64orect.c \ mach64pcach.c mach64pntwn.c mach64scrin.c mach64seg.c mach64text.c \ - mach64util.c mach64win.c vgaHW.c + mach64win.c vgaHW.c OBJS = ativga.o mach64.o mach64blt.o mach64bstor.o mach64cmap.o mach64curs.o \ mach64fcach.o mach64fifo.o mach64font.o mach64frect.o mach64fs.o \ mach64gc.o mach64im.o mach64init.o mach64line.o mach64orect.o \ mach64pcach.o mach64pntwn.o mach64scrin.o mach64seg.o mach64text.o \ - mach64util.o mach64win.o vgaHW.o + mach64win.o vgaHW.o INCLUDES = -I$(XF86COMSRC) -I. -I$(XF86SRC)/vga256/vga \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64blt.c.sparc Fri Jul 23 13:44:38 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/accel/mach64/mach64blt.c Fri Sep 20 19:14:57 2002 @@ -987,12 +987,12 @@ pdst = pdstLine; psrcLine += widthSrc; pdstLine += widthDst; - bits = *psrc++; + bits = swapb(*psrc++); nl = width; while (nl >= 32) { tmp = BitLeft(bits, leftShift); - bits = *psrc++; + bits = swapb(*psrc++); if (rightShift != 32) tmp |= BitRight(bits, rightShift); i = 32; @@ -1013,7 +1013,7 @@ */ if (rightShift != 32) { - bits = *psrc++; + bits = swapb(*psrc++); tmp |= BitRight (bits, rightShift); } i = 32; @@ -1034,12 +1034,12 @@ pdst = pdstLine; psrcLine += widthSrc; pdstLine += widthDst; - bits = *psrc++; + bits = swapb(*psrc++); nl = width; while (nl >= 32) { tmp = BitLeft(bits, leftShift); - bits = *psrc++; + bits = swapb(*psrc++); if (rightShift != 32) tmp |= BitRight(bits, rightShift); i = 32; @@ -1064,7 +1064,7 @@ */ if (rightShift != 32) { - bits = *psrc++; + bits = swapb(*psrc++); tmp |= BitRight (bits, rightShift); } i = 32; @@ -1074,8 +1074,7 @@ src = ((tmp >> (31 - i)) & 0x01) ? fgpixel : bgpixel; DoRop (result, rop, src, *pdst); - *pdst = (*pdst & ~planemask) | - (result & planemask); + *pdst = (*pdst & ~planemask) | (result & planemask); pdst++; } } @@ -1214,8 +1213,7 @@ GetBits (psrc, i, curBit, bitPos, bits); DoRop (result, rop, bits, *pdst); - *pdst = (*pdst & ~startmask) | - (result & startmask); + *pdst = (*pdst & ~startmask) | (result & startmask); pdst++; } nl = nlMiddle; @@ -1235,8 +1233,7 @@ GetBits (psrc, i, curBit, bitPos, bits); DoRop (result, rop, bits, *pdst); - *pdst = (*pdst & ~endmask) | - (result & endmask); + *pdst = (*pdst & ~endmask) | (result & endmask); } } } @@ -1325,12 +1322,12 @@ pdst = pdstLine; psrcLine += widthSrc; pdstLine += widthDst; - bits = *psrc++; + bits = swapb(*psrc++); nl = width; while (nl >= 32) { tmp = BitLeft(bits, leftShift); - bits = *psrc++; + bits = swapb(*psrc++); if (rightShift != 32) tmp |= BitRight(bits, rightShift); i = 32; @@ -1351,7 +1348,7 @@ */ if (rightShift != 32) { - bits = *psrc++; + bits = swapb(*psrc++); tmp |= BitRight (bits, rightShift); } i = 32; @@ -1372,12 +1369,12 @@ pdst = pdstLine; psrcLine += widthSrc; pdstLine += widthDst; - bits = *psrc++; + bits = swapb(*psrc++); nl = width; while (nl >= 32) { tmp = BitLeft(bits, leftShift); - bits = *psrc++; + bits = swapb(*psrc++); if (rightShift != 32) tmp |= BitRight(bits, rightShift); i = 32; @@ -1402,7 +1399,7 @@ */ if (rightShift != 32) { - bits = *psrc++; + bits = swapb(*psrc++); tmp |= BitRight (bits, rightShift); } i = 32; @@ -1553,8 +1550,7 @@ GetBits (psrc, i, curBit, bitPos, bits); DoRop (result, rop, bits, *pdst); - *pdst = (*pdst & ~startmask) | - (result & startmask); + *pdst = (*pdst & ~startmask) | (result & startmask); pdst++; } nl = nlMiddle; @@ -1574,8 +1570,7 @@ GetBits (psrc, i, curBit, bitPos, bits); DoRop (result, rop, bits, *pdst); - *pdst = (*pdst & ~endmask) | - (result & endmask); + *pdst = (*pdst & ~endmask) | (result & endmask); } } } --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/compiler.h.sparc Fri Jul 30 12:58:14 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/compiler.h Fri Sep 20 19:14:59 2002 @@ -113,6 +113,107 @@ #ifdef __GNUC__ +#if defined(__sparc__) + +#define ASI_PL 0x88 + +static __inline__ void +outb(port, val) + unsigned long port; + unsigned char val; +{ + __asm__ __volatile__("stba %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); +} + +static __inline__ void +outw(port, val) + unsigned long port; + unsigned short val; +{ + __asm__ __volatile__("stha %0, [%1] %2" : : "r" (val), "r" (port), "i" (ASI_PL)); +} + +static __inline__ void +outl(port, val) + unsigned long port; + unsigned int 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 short 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 int ret; + __asm__ __volatile__("lda [%1] %2, %0" : "=r" (ret) : "r" (port), "i" (ASI_PL)); + return ret; +} + +#include + +static __inline__ unsigned long ldq_u(unsigned long *p) +{ + unsigned long ret; + memmove(&ret, p, sizeof(*p)); + return ret; +} + +static __inline__ unsigned int ldl_u(unsigned int *p) +{ + unsigned int ret; + memmove(&ret, p, sizeof(*p)); + return ret; +} + +static __inline__ unsigned short ldw_u(unsigned short *p) +{ + unsigned short ret; + memmove(&ret, p, sizeof(*p)); + return ret; +} + +static __inline__ void stq_u(unsigned long val, unsigned long *p) +{ + unsigned long tmp = val; + memmove(p, &tmp, sizeof(*p)); +} + +static __inline__ void stl_u(unsigned int val, unsigned int *p) +{ + unsigned int tmp = val; + memmove(p, &tmp, sizeof(*p)); +} + +static __inline__ void stw_u(unsigned short val, unsigned short *p) +{ + unsigned short tmp = val; + memmove(p, &tmp, sizeof(*p)); +} + +#define mem_barrier() /* XXX: nop for now */ +#define write_mem_barrier() /* XXX: nop for now */ + +#else /* defined(__sparc__) */ + #if defined(__alpha__) # if defined(linux) /* for Linux on Alpha, we use the LIBC _inx/_outx routines */ @@ -1013,6 +1114,7 @@ #endif /* defined(mips) */ #endif /* defined(AlphaArchitecture) && defined(LinuxArchitecture) */ +#endif /* defined(__sparc__) */ #else /* __GNUC__ */ #if !defined(AMOEBA) && !defined(MINIX) && !defined(__QNX__) --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86Io.c.sparc Fri Jul 30 12:58:18 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86Io.c Fri Sep 20 19:15:02 2002 @@ -553,7 +553,7 @@ } #endif -#if !defined(AMOEBA) && !(defined (sun) && defined(i386) && defined (SVR4)) && !defined(MINIX) && !defined(__mips__) && !(defined(__QNX__) && !defined(__QNXNTO__)) +#if !defined(AMOEBA) && !(defined (sun) && defined(i386) && defined (SVR4)) && !defined(MINIX) && !defined(__mips__) && !(defined(__QNX__) && !defined(__QNXNTO__)) || (!defined (__sparc__) || !defined (linux)) /* * These are getting tossed in here until I can think of where * they really belong --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86XKB.c.sparc Sat Dec 28 11:14:43 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86XKB.c Fri Sep 20 19:15:04 2002 @@ -71,6 +71,24 @@ #endif { CARD32 old; +#if defined (__sparc__) + static int kbdSun = -1; + + if (kbdSun == -1) { + if (xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) + kbdSun = 1; + else + kbdSun = 0; + } + if (kbdSun) { + old = new; + new = 0; + if (old & 0x08) new |= XLED1; + if (old & 0x04) new |= XLED3; + if (old & 0x02) new |= XLED4; + if (old & 0x01) new |= XLED2; + } +#endif /* defined (__sparc__) */ #ifdef DEBUG /* if (xkbDebugFlags)*/ ErrorF("XkbDDXUpdateIndicators(...,0x%x) -- XFree86 version\n",new); @@ -81,6 +99,9 @@ if (old&XLED1) new|= LED_CAP; if (old&XLED2) new|= LED_NUM; if (old&XLED3) new|= LED_SCR; +#ifdef LED_COMP + if (old&XLED4) new|= LED_COMP; +#endif #endif xf86SetKbdLeds(new); return; --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86Events.c.sparc Mon Dec 20 16:35:52 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86Events.c Fri Sep 20 19:15:05 2002 @@ -482,6 +482,9 @@ #if defined(SYSCONS_SUPPORT) || defined(PCVT_SUPPORT) static Bool first_time = TRUE; #endif +#if defined(__sparc__) + static int kbdSun = -1; +#endif #if defined(CODRV_SUPPORT) if (xf86Info.consType == CODRV011 || xf86Info.consType == CODRV01X) @@ -497,6 +500,17 @@ } #endif +#if defined (__sparc__) + if (kbdSun == -1) { + if (xf86Info.xkbmodel && !strcmp(xf86Info.xkbmodel, "sun")) + kbdSun = 1; + else + kbdSun = 0; + } + if (kbdSun) + goto special; +#endif /* defined (__sparc__) */ + #if defined (i386) && defined (SVR4) && !defined (PC98) /* * PANIX returns DICOP standards based keycodes in using 106jp @@ -657,6 +671,39 @@ specialkey = scanCode; #endif /* ASSUME_CUSTOM_KEYCODES */ +#if defined (__sparc__) +special: + if (kbdSun) { + switch (scanCode) { + case 0x2b: specialkey = KEY_BackSpace; break; + case 0x47: specialkey = KEY_KP_Minus; break; + case 0x7d: specialkey = KEY_KP_Plus; break; + case 0x05: specialkey = KEY_F1; break; + case 0x06: specialkey = KEY_F2; break; + case 0x08: specialkey = KEY_F3; break; + case 0x0a: specialkey = KEY_F4; break; + case 0x0c: specialkey = KEY_F5; break; + case 0x0e: specialkey = KEY_F6; break; + case 0x10: specialkey = KEY_F7; break; + case 0x11: specialkey = KEY_F8; break; + case 0x12: specialkey = KEY_F9; break; + case 0x07: specialkey = KEY_F10; break; + case 0x09: specialkey = KEY_F11; break; + case 0x0b: specialkey = KEY_F12; break; + default: specialkey = 0; break; + } + /* + * XXX XXX XXX: + * + * I really don't know what's wrong here, but passing the real + * scanCode offsets by one from XKB's point of view. + * + * (ecd@skynet.be, 980405) + */ + scanCode--; + } +#endif /* defined (__sparc__) */ + if ((ModifierDown(ControlMask | AltMask)) || (ModifierDown(ControlMask | AltLangMask))) { @@ -907,6 +954,7 @@ /* * Now map the scancodes to real X-keycodes ... */ + keycode = scanCode + MIN_KEYCODE; keysym = (keyc->curKeySyms.map + keyc->curKeySyms.mapWidth * --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86_Config.h.sparc Fri Dec 3 09:42:23 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86_Config.h Fri Sep 20 19:18:47 2002 @@ -187,9 +187,10 @@ #define AUTOMOUSE 1038 #define ACECAD 1039 #define WSMOUSE 1040 -#define USBMOUSE 1041 +#define SUN 1041 #define XQUE 1042 #define OSMOUSE 1043 +#define USBMOUSE 1044 #ifdef INIT_CONFIG static SymTabRec MouseTab[] = { @@ -214,6 +215,7 @@ { AUTOMOUSE, "auto" }, { ACECAD, "acecad" }, { WSMOUSE, "wsmouse" }, + { SUN, "sun" }, { XQUE, "xqueue" }, { OSMOUSE, "osmouse" }, { USBMOUSE, "usb" }, @@ -559,7 +561,8 @@ #define P_AUTO 18 /* automatic */ #define P_ACECAD 19 /* ACECAD protocol */ #define P_WSMOUSE 20 /* NetBSD wsmouse */ -#define P_USB 21 /* USB mouse */ +#define P_SUN 21 /* Sun Microsystems */ +#define P_USB 22 /* USB mouse */ #define EMULATE3 50 #define BAUDRATE 51 --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h.sparc Sun Dec 20 11:45:31 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86Priv.h Fri Sep 20 19:19:00 2002 @@ -126,6 +126,7 @@ #define XLED1 ((unsigned long) 0x00000001) #define XLED2 ((unsigned long) 0x00000002) #define XLED3 ((unsigned long) 0x00000004) +#define XLED4 ((unsigned long) 0x00000008) #define XCAPS ((unsigned long) 0x20000000) #define XNUM ((unsigned long) 0x40000000) #define XSCR ((unsigned long) 0x80000000) --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c.sparc Mon Dec 20 16:35:55 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common/xf86_Mouse.c Fri Sep 20 19:23:19 2002 @@ -140,6 +140,11 @@ #else FALSE, /* wsmouse */ #endif +#ifdef __sparc__ + TRUE, /* Sun mouse */ +#else + FALSE, +#endif #ifdef USB_MOUSE TRUE, #else @@ -183,6 +188,7 @@ (CS8 | CSTOPB | CREAD | CLOCAL | HUPCL ), /* sysmouse */ 0, /* auto */ (CS8 | PARENB | PARODD | CREAD | CLOCAL | HUPCL ), /* ACECAD */ + 0, /* Sun Mouse */ }; #endif /* ! MOUSE_PROTOCOL_IN_KERNEL */ @@ -239,6 +245,9 @@ #else { 0x00, 0x00, 0x00, 0x00, 0, 0x00, 0x00 }, /* wsmouse */ #endif +#ifdef __sparc__ + { 0xf8, 0x80, 0x00, 0x00, 5, 0x00, 0xff }, /* Sun Mouse */ +#endif { 0x00, 0x00, 0x00, 0x00, 0, 0x00, 0x00 }, /* USB mouse */ }; #endif /* ! MOUSE_PROTOCOL_IN_KERNEL */ @@ -585,6 +594,9 @@ break; #endif + case P_SUN: /* Sun Mouse */ + break; + #ifdef USB_MOUSE case P_USB: mouse->usb = usbMouseInit(mouse); @@ -874,6 +886,7 @@ break; case P_BM: /* BusMouse */ + case P_SUN: #if defined(__NetBSD__) case P_PS2: #endif --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/SlowBcopy.c.sparc Fri Jul 23 13:45:10 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/SlowBcopy.c Fri Sep 20 19:23:24 2002 @@ -28,7 +28,9 @@ while(len--) { *dst++ = *src++; +#ifndef __sparc__ outb(0x80, 0x00); +#endif } } --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/xf86_PCI.c.sparc Sun Dec 20 11:45:36 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/xf86_PCI.c Fri Sep 20 19:23:26 2002 @@ -490,29 +490,38 @@ static int pciConfigType = 0; static int pciMaxDevice = 0; -#if defined(__alpha__) +#if defined(__alpha__) || defined(__sparc__) #include +#if defined(__sparc__) +#if !defined(__NR_pciconfig_read) +#define __NR_pciconfig_read 148 +#define __NR_pciconfig_write 149 +#endif +#ifdef __GLIBC__ +#define __syscall syscall +#endif +#endif #define BUS(tag) (((tag)>>16)&0xff) #define DFN(tag) (((tag)>>8)&0xff) int pciconfig_read( - unsigned char bus, - unsigned char dfn, - unsigned char off, - unsigned char len, + unsigned long bus, + unsigned long dfn, + unsigned long off, + unsigned long len, void * buf) { return syscall(__NR_pciconfig_read, bus, dfn, off, len, buf); } int pciconfig_write( - unsigned char bus, - unsigned char dfn, - unsigned char off, - unsigned char len, + unsigned long bus, + unsigned long dfn, + unsigned long off, + unsigned long len, void * buf) { return syscall(__NR_pciconfig_write, bus, dfn, off, len, buf); } -#endif /* __alpha__ */ +#endif /* __alpha__ || __sparc__ */ static Bool pcibusCheck() @@ -542,7 +551,7 @@ setupDone = TRUE; -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (xf86PCIFlags) { case PCIProbe1: /* { */ @@ -781,18 +790,18 @@ } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ pciConfigType = 1; pciMaxDevice = PCI_CONFIG1_MAXDEV; if (pcibusCheck()) { if (xf86Verbose > 1) { - ErrorF("PCI: Config type is 1(axp)\n"); + ErrorF("PCI: Config type is 1(axp,sparc)\n"); } return; } pciConfigType = 0; pciMaxDevice = 0; -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ /* No PCI found */ @@ -817,7 +826,7 @@ case 1: if (cardnum < PCI_CONFIG1_MAXDEV) { tag.cfg1 = -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) PCI_EN | #endif ((CARD32)bus << 16) | @@ -860,11 +869,13 @@ { CARD32 addr, data = 0; +#ifndef __sparc__ if (!tag.cfg1) { return 0xffffffff; } +#endif /* !(__sparc__) */ -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (pciConfigType) { case 1: addr = tag.cfg1 | (reg & 0xfc); @@ -881,9 +892,9 @@ outb(PCI_MODE2_FORWARD_REG, 0); break; } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ pciconfig_read(BUS(tag.cfg1), DFN(tag.cfg1), reg, 4, &data); -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ return data; } @@ -897,7 +908,7 @@ return 0xff; } -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (pciConfigType) { case 1: addr = tag.cfg1 | (reg & 0xfc); @@ -914,9 +925,9 @@ outb(PCI_MODE2_FORWARD_REG, 0); break; } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ pciconfig_read(BUS(tag.cfg1), DFN(tag.cfg1), reg, 2, &data); -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ return data; } @@ -930,7 +941,7 @@ return 0xff; } -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (pciConfigType) { case 1: addr = tag.cfg1 | (reg & 0xfc); @@ -947,9 +958,9 @@ outb(PCI_MODE2_FORWARD_REG, 0); break; } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ pciconfig_read(BUS(tag.cfg1), DFN(tag.cfg1), reg, 1, &data); -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ return data; } @@ -962,7 +973,7 @@ return; } -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (pciConfigType) { case 1: addr = tag.cfg1 | (reg & 0xfc); @@ -979,10 +990,10 @@ outb(PCI_MODE2_FORWARD_REG, 0); break; } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ addr = data; pciconfig_write(BUS(tag.cfg1), DFN(tag.cfg1), reg, 4, &addr); -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ } void @@ -994,7 +1005,7 @@ return; } -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (pciConfigType) { case 1: addr = tag.cfg1 | (reg & 0xfc); @@ -1011,10 +1022,10 @@ outb(PCI_MODE2_FORWARD_REG, 0); break; } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ addr = data; pciconfig_write(BUS(tag.cfg1), DFN(tag.cfg1), reg, 2, &addr); -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ } void @@ -1026,7 +1037,7 @@ return; } -#if !defined(__alpha__) +#if !defined(__alpha__) && !defined(__sparc__) switch (pciConfigType) { case 1: addr = tag.cfg1 | (reg & 0xfc); @@ -1043,10 +1054,10 @@ outb(PCI_MODE2_FORWARD_REG, 0); break; } -#else /* !__alpha__ */ +#else /* !defined(__alpha__) || !defined(__sparc__) */ addr = data; pciconfig_write(BUS(tag.cfg1), DFN(tag.cfg1), reg, 1, &addr); -#endif /* !__alpha__ */ +#endif /* !defined(__alpha__) || !defined(__sparc__) */ } static void @@ -1077,7 +1088,11 @@ /* Detect a multi-function device that complies to the PCI 2.0 spec */ tag0 = pcibusTag(bus, cardnum, 0); - if (pcibusRead(tag0, PCI_HEADER_MISC) & PCI_HEADER_MULTIFUNCTION) + id0 = pcibusRead(tag0, PCI_HEADER_MISC); + if (id0 == 0xffffffff) + return FALSE; + + if (id0 & PCI_HEADER_MULTIFUNCTION) return TRUE; /* @@ -1103,7 +1118,8 @@ xf86scanpci(int scrnIndex) { pciConfigRec pcr; - int pcibusidx, pcinumbus, pcibuses[16]; + pciTagRec tag; + int pcibusidx, pcinumbus, pcibuses[256]; int idx = 0, hostbridges = 0; if (pci_devp[0]) @@ -1117,14 +1133,32 @@ if (pciConfigType == 0) return (pciConfigPtr *)NULL; +#if defined(__sparc__) + pcinumbus = 0; + pcr._cardnum = pcr._func = 0; + for (pcr._bus = 0; pcr._bus < 256; pcr._bus++) { + tag = pcibusTag(pcr._bus, pcr._cardnum, 0); + pcr._device_vendor = pcibusRead(tag, PCI_ID_REG); + if (pcr._device_vendor == 0xffffffff) /* nothing there */ + continue; + pcr._class_revision = pcibusRead(tag, PCI_CLASS_REG); + if (pcr._base_class == PCI_CLASS_BRIDGE && + pcr._sub_class == PCI_SUBCLASS_BRIDGE_HOST) { + pcibuses[pcinumbus++] = pcr._bus; + } + } + if (!pcinumbus) + return NULL; pcibusidx = 0; +#else /* defined(__sparc__) */ pcibuses[0] = 0; pcinumbus = 1; + pcibusidx = 0; +#endif /* defined(__sparc__) */ do { for (pcr._cardnum = 0; pcr._cardnum < pciMaxDevice; pcr._cardnum++) { int maxfunc = 0; - pciTagRec tag; pcr._bus = pcibuses[pcibusidx]; --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/xf86_PCI.h.sparc Sat Oct 24 07:53:12 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/xf86_PCI.h Fri Sep 20 19:23:27 2002 @@ -38,8 +38,13 @@ union { CARD32 device_vendor; struct { +#if defined(__sparc__) + CARD16 device; + CARD16 vendor; +#else CARD16 vendor; CARD16 device; +#endif } dv; } dv_id; #define _device_vendor dv_id.device_vendor @@ -48,8 +53,13 @@ union { CARD32 status_command; struct { +#if defined(__sparc__) + CARD16 status; + CARD16 command; +#else CARD16 command; CARD16 status; +#endif } sc; } stat_cmd; #define _status_command stat_cmd.status_command @@ -58,10 +68,17 @@ union { CARD32 class_revision; struct { +#if defined(__sparc__) + CARD8 base_class; + CARD8 sub_class; + CARD8 prog_if; + CARD8 rev_id; +#else CARD8 rev_id; CARD8 prog_if; CARD8 sub_class; CARD8 base_class; +#endif } cr; } class_rev; #define _class_revision class_rev.class_revision @@ -72,10 +89,17 @@ union { CARD32 bist_header_latency_cache; struct { +#if defined(__sparc__) + CARD8 bist; + CARD8 header_type; + CARD8 latency_timer; + CARD8 cache_line_size; +#else CARD8 cache_line_size; CARD8 latency_timer; CARD8 header_type; CARD8 bist; +#endif } bhlc; } bhlc; #define _bist_header_latency_cache bhlc.bist_header_latency_cache @@ -94,6 +118,19 @@ } dv; struct { CARD32 bg_rsrvd[2]; +#if defined(__sparc__) + CARD8 secondary_latency_timer; + CARD8 subordinate_bus_number; + CARD8 secondary_bus_number; + CARD8 primary_bus_number; + CARD16 secondary_status; + CARD8 io_limit; + CARD8 io_base; + CARD16 mem_limit; + CARD16 mem_base; + CARD16 prefetch_mem_limit; + CARD16 prefetch_mem_base; +#else CARD8 primary_bus_number; CARD8 secondary_bus_number; CARD8 subordinate_bus_number; @@ -105,6 +142,7 @@ CARD16 mem_limit; CARD16 prefetch_mem_base; CARD16 prefetch_mem_limit; +#endif } bg; } bc; #define _base0 bc.dv.dv_base0 @@ -132,10 +170,17 @@ union { CARD32 max_min_ipin_iline; struct { +#if defined(__sparc__) + CARD8 max_lat; + CARD8 min_gnt; + CARD8 int_pin; + CARD8 int_line; +#else CARD8 int_line; CARD8 int_pin; CARD8 min_gnt; CARD8 max_lat; +#endif } mmii; } mmii; #define _max_min_ipin_iline mmii.max_min_ipin_iline @@ -147,10 +192,17 @@ union { CARD32 user_config; struct { +#if defined(__sparc__) + CARD8 user_config_3; + CARD8 user_config_2; + CARD8 user_config_1; + CARD8 user_config_0; +#else CARD8 user_config_0; CARD8 user_config_1; CARD8 user_config_2; CARD8 user_config_3; +#endif } uc; } uc; #define _user_config uc.user_config @@ -174,9 +226,15 @@ typedef union { CARD32 cfg1; struct { +#if defined(__sparc__) + CARD16 port; + CARD8 forward; + CARD8 enable; +#else CARD8 enable; CARD8 forward; CARD16 port; +#endif } cfg2; CARD32 tag; } pciTagRec, *pciTagPtr; --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/Imakefile.sparc Tue Feb 24 21:01:21 1998 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/common_hw/Imakefile Fri Sep 20 19:23:29 2002 @@ -15,6 +15,10 @@ XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c $(IOSRC) XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o $(IOOBJ) #else +#if defined(LinuxArchitecture) && defined(SparcArchitecture) +XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c $(IOSRC) +XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o $(IOOBJ) +#else #if defined(ArcArchitecture) XSRCS = BUSmemcpy.c IODelay.c SlowBcopy.c $(IOSRC) XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o $(IOOBJ) @@ -23,6 +27,7 @@ XOBJS = BUSmemcpy.o IODelay.o SlowBcopy.o #endif #endif +#endif SRCS = I2061Acal.c I2061Aset.c I2061Aalt.c xf86_ClkPr.c \ SC11412.c ATTDac.c S3gendac.c Ti3025clk.c \ @@ -42,7 +47,7 @@ NormalLibraryTarget(xf86_hw,$(OBJS)) -#if !(defined(LinuxArchitecture) && defined(AlphaArchitecture)) && !defined(ArcArchitecture) +#if !(defined(LinuxArchitecture) && defined(AlphaArchitecture)) && !defined(SparcArchitecture) && !defined(ArcArchitecture) ObjectFromAsmSource(BUSmemcpy,NullParameter) ObjectFromAsmSource(IODelay,NullParameter) ObjectFromAsmSource(SlowBcopy,NullParameter) --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c.sparc Fri Jul 23 13:46:55 1999 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c Fri Sep 20 19:23:41 2002 @@ -52,11 +52,24 @@ #define BUS_BASE (isJensen ? _bus_base_sparse() : _bus_base()) #define JENSEN_SHIFT(x) (isJensen ? ((long)x< +#endif + #endif /* linux */ /**************************************************************************/ --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/vga16/vga/Imakefile.sparc Mon Dec 23 06:54:05 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/vga16/vga/Imakefile Fri Sep 20 19:23:49 2002 @@ -8,9 +8,17 @@ #include -SRCS = vgaHW.c vga.c vgaCmap.c vgaBank.s vgaPCI.c +#ifdef i386Architecture +VGABANKSRCS = vgaBank.s +VGABANKOBJS = vgaBank.o +#else +VGABANKSRCS = vgaBankc.c +VGABANKOBJS = vgaBankc.o +#endif + +SRCS = vgaHW.c vga.c vgaCmap.c vgaPCI.c $(VGABANKSRCS) -OBJS = vgaHW.o vga.o vgaCmap.o vgaBank.o vgaPCI.o +OBJS = vgaHW.o vga.o vgaCmap.o vgaPCI.o $(VGABANKOBJS) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(XF86HWSRC) \ -I$(XF86SRC)/vga256/vga -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ @@ -29,7 +37,11 @@ LinkSourceFile(vga.c,../../vga256/vga) LinkSourceFile(vgaHW.c,../../vga256/vga) LinkSourceFile(vgaCmap.c,../../vga256/vga) +#ifdef i386Architecture LinkSourceFile(vgaBank.s,../../vga256/vga) +#else +LinkSourceFile(vgaBankc.c,../../vga256/vga) +#endif LinkSourceFile(vgaPCI.c,../../vga256/vga) DependTarget() --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaBankc.c.sparc Mon Dec 9 11:54:41 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaBankc.c Fri Sep 20 19:23:52 2002 @@ -82,9 +82,11 @@ register pointer p; { #ifdef XF86VGA16 - writeseg = ((unsigned long)p - vgaBase) >> vgaSegmentShift; + writeseg = ((unsigned long)p - (unsigned long)vgaBase) >> vgaSegmentShift; (vgaSetReadWriteFunc)(writeseg); - return (vgaWriteBottom + (((unsigned long)p - vgaBase) & vgaSegmentMask)); + return (pointer) + ((unsigned long)vgaWriteBottom + + (((unsigned long)p - (unsigned long)vgaBase) & vgaSegmentMask)); #else writeseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; (vgaSetReadWriteFunc)(writeseg); @@ -150,9 +152,11 @@ register pointer p; { #ifdef XF86VGA16 - readseg = ((unsigned long)p - vgaBase) >> vgaSegmentShift; + readseg = ((unsigned long)p - (unsigned long)vgaBase) >> vgaSegmentShift; (vgaSetReadFunc)(readseg); - return (vgaReadBottom + (((unsigned long)p - vgaBase) & vgaSegmentMask)); + return (pointer) + ((unsigned long)vgaReadBottom + + (((unsigned long)p - (unsigned long)vgaBase) & vgaSegmentMask)); #else readseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; (vgaSetReadFunc)(readseg); @@ -217,9 +221,11 @@ register pointer p; { #ifdef XF86VGA16 - writeseg = ((unsigned long)p - vgaBase) >> vgaSegmentShift; + writeseg = ((unsigned long)p - (unsigned long)vgaBase) >> vgaSegmentShift; (vgaSetWriteFunc)(writeseg); - return (vgaWriteBottom + (((unsigned long)p - vgaBase) & vgaSegmentMask)); + return (pointer) + ((unsigned long)vgaWriteBottom + + (((unsigned long)p - (unsigned long)vgaBase) & vgaSegmentMask)); #else writeseg = ((unsigned long)p - VGABASE) >> vgaSegmentShift; (vgaSetWriteFunc)(writeseg); --- XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaBank.h.sparc Mon Dec 23 06:59:28 1996 +++ XFree86-3.3.6/xc/programs/Xserver/hw/xfree86/vga256/vga/vgaBank.h Fri Sep 20 19:23:53 2002 @@ -33,7 +33,7 @@ extern void *vgaWriteBottom; extern void *vgaWriteTop; extern Bool vgaReadFlag, vgaWriteFlag; -#if defined(__alpha__) +#if defined(__alpha__) || defined(__sparc__) extern unsigned long writeseg; #else /* __alpha__ */ extern void *writeseg; --- XFree86-3.3.6/xc/programs/Xserver/include/servermd.h.sparc Fri Jul 23 13:49:56 1999 +++ XFree86-3.3.6/xc/programs/Xserver/include/servermd.h Fri Sep 20 19:23:55 2002 @@ -154,7 +154,8 @@ (defined(__uxp__) && (defined(sparc) || defined(mc68000))) || \ (defined(Lynx) && defined(__sparc__)) || \ ((defined(__NetBSD__) || defined(__OpenBSD__)) && \ - (defined(__sparc__) || defined(__mc68000__))) + (defined(__sparc__) || defined(__mc68000__))) || \ + (defined(linux) && defined(__sparc__)) #if defined(sun386) || defined(sun5) # define IMAGE_BYTE_ORDER LSBFirst /* Values for the SUN only */ @@ -336,7 +337,7 @@ #endif /* luna */ -#if (defined(i386) && (defined(SVR4) || defined(SYSV) || (defined(sun) && defined(SVR4))) || defined(__bsdi__) || (defined(__NetBSD__) && defined(__i386__)) || (defined(__OpenBSD__) && defined(__i386__)) || defined(__FreeBSD__) || defined(MACH386) || (defined(linux) && !defined(__mc68000__) && !defined(__powerpc__)) || (defined(AMOEBA) && defined(i80386)) || defined(MINIX) || defined(__EMX__) || (defined(Lynx) && defined(__i386__)) || (defined(__GNU__) && defined(__i386__))) || defined(__QNX__) +#if (defined(i386) && (defined(SVR4) || defined(SYSV) || (defined(sun) && defined(SVR4))) || defined(__bsdi__) || (defined(__NetBSD__) && defined(__i386__)) || (defined(__OpenBSD__) && defined(__i386__)) || defined(__FreeBSD__) || defined(MACH386) || (defined(linux) && !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__)) || (defined(AMOEBA) && defined(i80386)) || defined(MINIX) || defined(__EMX__) || (defined(Lynx) && defined(__i386__)) || (defined(__GNU__) && defined(__i386__))) || defined(__QNX__) #ifndef IMAGE_BYTE_ORDER #define IMAGE_BYTE_ORDER LSBFirst --- XFree86-3.3.6/xc/programs/Xserver/Imakefile.sparc Fri Dec 3 09:39:48 1999 +++ XFree86-3.3.6/xc/programs/Xserver/Imakefile Fri Sep 20 19:23:58 2002 @@ -251,13 +251,21 @@ XCOMM MFBDIR = mfb CFB8DIR = cfb +#ifdef LinuxArchitecture +DDXDIR3 = hw/sun +#else DDXDIR1 = hw/sun +#endif #ifndef AmoebaArchitecture -SUNOBJS = hw/sun/sunInit.o +#ifdef LinuxArchitecture +SUNOBJS = hw/sun/sunInit.o hw/sun/sunGX.o hw/sun/sunCfb.o hw/sun/stubs.o +#else +SUNOBJS = hw/sun/sunInit.o hw/sun/sunGX.o hw/sun/sunCfb.o +#endif #else -SUNOBJS = hw/sun/sunInitColor.o +SUNOBJS = hw/sun/sunInitColor.o hw/sun/sunGX.o hw/sun/sunCfb.o #endif -SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(DDXDIR1) $(DEPDIRS) +SUNDIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) hw/sun $(DEPDIRS) SUNLIBS = hw/sun/LibraryTargetName(sun) CFB8Libs SUNSYSLIBS = $(WIDECHARSYSLIB) $(SYSLIBS) SetUIDServerTarget(Xsun,$(SUNDIRS),$(SUNOBJS),$(SUNLIBS),$(SUNSYSLIBS)) @@ -276,9 +284,17 @@ CFB16DIR = cfb16 CFB24DIR = cfb24 CFB32DIR = cfb32 +#ifdef LinuxArchitecture +DDXDIR3 = hw/sun +#else DDXDIR1 = hw/sun -SUN24DIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) $(DDXDIR1) $(DEPDIRS) -SUN24OBJS = hw/sun/sunInitMulti.o +#endif +SUN24DIRS = $(STDDIRS) $(MFBDIR) $(CFB8DIR) $(CFB16DIR) $(CFB24DIR) $(CFB32DIR) hw/sun $(DEPDIRS) +#ifdef LinuxArchitecture +SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/sunGX.o hw/sun/sunFFB.o hw/sun/sunCfb.o hw/sun/sunCfb24.o hw/sun/stubs.o +#else +SUN24OBJS = hw/sun/sunInitMulti.o hw/sun/sunGX.o hw/sun/sunFFB.o hw/sun/sunCfb.o hw/sun/sunCfb24.o +#endif SUN24LIBS = hw/sun/LibraryTargetName(sun) CFBLibs SetUIDServerTarget(Xsun24,$(SUN24DIRS),$(SUN24OBJS),$(SUN24LIBS),$(SYSLIBS)) #ifndef ServerToInstall @@ -292,9 +308,17 @@ XCOMM Sun monochrome server XCOMM MFBDIR = mfb +#ifdef LinuxArchitecture +DDXDIR3 = hw/sun +#else DDXDIR1 = hw/sun -SUNMDIRS = $(STDDIRS) $(MFBDIR) $(DDXDIR1) $(DEPDIRS) +#endif +SUNMDIRS = $(STDDIRS) $(MFBDIR) hw/sun $(DEPDIRS) +#ifdef LinuxArchitecture +SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o hw/sun/stubs.o +#else SUNMOBJS = hw/sun/sunInitMono.o hw/sun/sunInExMono.o +#endif SUNMLIBS = hw/sun/LibraryTargetName(sun) MFBBareLibs $(OTHEREXTS) SetUIDServerTarget(XsunMono,$(SUNMDIRS),$(SUNMOBJS),$(SUNMLIBS),$(SYSLIBS)) #ifndef ServerToInstall --- XFree86-3.3.6/xc/programs/rgb/Imakefile.sparc Sun Oct 4 14:43:55 1998 +++ XFree86-3.3.6/xc/programs/rgb/Imakefile Fri Sep 20 19:24:01 2002 @@ -21,7 +21,7 @@ OBJS = $(OBJS1) $(OBJS2) PROGRAMS = $(RGB_PROG) ProgramTargetName(showrgb) #if !UseRgbTxt -#if defined(BSD386Architecture) || defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) +#if defined(BSD386Architecture) || defined(NetBSDArchitecture) || defined(OpenBSDArchitecture) || (defined(SparcArchitecture) && defined(LinuxArchitecture)) DATAFILES = rgb.db DATADEP = rgb.db #else @@ -40,6 +40,9 @@ DBMLIB = DBMLibrary -lucb #endif #endif /*!UseRgbTxt */ +#if defined(LinuxSparc) + DBMLIB = -ldb +#endif all:: $(PROGRAMS) $(DATADEP) --- XFree86-3.3.6/xc/programs/xterm/main.c.sparc Fri Dec 3 09:49:48 1999 +++ XFree86-3.3.6/xc/programs/xterm/main.c Fri Sep 20 19:24:03 2002 @@ -180,6 +180,38 @@ #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)) #include #endif +/* undefine all the sun specific terminal stuff */ +#undef TIOCHPCL +#undef TIOCMODG +#undef TIOCMODS +#undef TIOCGETP +#undef TIOCSETP +#undef TIOCSETN +#undef TIOCFLUSH +#undef TIOCSETC +#undef TIOCGETC +#undef TIOCTCNTL +#undef TIOCSIGNAL +#undef TIOCSETX +#undef TIOCGETX +#undef TIOCSSIZE +#undef TIOCGSIZE +#undef TIOCUCNTL +#undef TIOCREMOTE +#undef TIOCSTART +#undef TIOCSTOP +#undef TIOCGLTC +#undef TIOCSLTC +#undef TIOCCDTR +#undef TIOCSDTR +#undef TIOCCBRK +#undef TIOCSBRK +#undef TIOCLGET +#undef TIOCLSET +#undef TIOCLBIC +#undef TIOCLBIS +#undef TIOCISPACE +#undef TIOCISIZE #endif #ifdef __CYGWIN__ @@ -269,7 +301,7 @@ #undef TIOCLSET /* defined, but not useable */ #endif -#ifdef __GNU__ +#ifdef __GNU__ || (defined(linux) && defined(sparc)) #undef TIOCLSET #undef TIOCSLTC #endif @@ -629,6 +661,9 @@ /* allow use of system default characters if defined and reasonable */ #ifndef CEOF #define CEOF CTRL('D') +#endif +#ifndef CDSUSP +#define CDSUSP CTRL('Y') #endif #ifndef CSUSP #define CSUSP CTRL('Z')