Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!ibmpa!dolphin.tcspa.ibm.com!mlewis From: mlewis@dolphin.tcspa.ibm.com (Mark S. Lewis) Newsgroups: comp.sys.ibm.pc.rt Subject: IBM 8514 source code (part 3 of 6) for X11 Release 4 Keywords: V1.32_kit.3 8514 X11R4 Message-ID: <4473@ibmpa.UUCP> Date: 12 Mar 90 23:18:29 GMT Sender: news@ibmpa.UUCP Reply-To: mlewis@ibmsupt.UUCP Followup-To: comp.sys.ibm.pc.rt Organization: IBM AWD, Palo Alto Lines: 1982 Subject: IBM 8514 source code (part 3 of 6) for X11 Release 4 Index: ../mit/server/ddx/ibm/ibm8514 Description: IBM has decided to provide X11 source code for the 8514 display adapter. This is the same code used to build the object files included in the X11 Release 4 distribution. This code supports servers for both AIX and IBM/4.3 on their respective platforms. V1.32_kit.1 59,103 Bytes V1.32_kit.2 61,796 Bytes V1.32_kit.3 60,982 Bytes V1.32_kit.4 62,729 Bytes V1.32_kit.5 54,871 Bytes V1.32_kit.6 29,170 Bytes Installation: This code is provided in a 6-part shell archive. Before you install it, you should save your current code. You should save the Imakefile in the ibm server directory. You also should save the entire ibm8514 directory by moving and remaking it. cd ../mit/server/ddx/ibm cp Imakefile Imakefile.orig mv ibm8514 ibm8514.orig mkdir ibm8514 Next, edit this header from each part, and feed the rest to /bin/sh. Proceed to make the server as instructed in the X11 release notes. sh < V1.32_kit.3 =====----- Mark S. Lewis, IBM AWD Palo Alto -----====== inet: mlewis%ibmsupt@uunet.uu.net (415) 855-4486 uucp: uunet!ibmsupt!mlewis IBM Tie Line: 465-4486 # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # # ibm8514/brcFillSp.c # ibm8514/brcFont.c # ibm8514/brcFonts.h # ibm8514/brcGBlt.c # ibm8514/brcGC.c # ibm8514/brcGetSp.c # ibm8514/brcIO.c # echo x - ibm8514/brcFillSp.c sed 's/^X//' >ibm8514/brcFillSp.c << 'END-of-ibm8514/brcFillSp.c' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* X * Hardware interface routines for IBM 8514/A adapter for X * X.11 server(s) on IBM equipment. X * X */ X X/* $Header: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcFillSp.c,v 6.3 89/05/07 15:18:34 jeff Exp $ */ X/* $Source: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcFillSp.c,v $ */ X X#ifndef lint Xstatic char *rcsid = "$Header: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcFillSp.c,v 6.3 89/05/07 15:18:34 jeff Exp $" ; X#endif X X#include "X.h" X#include "misc.h" X#include "gcstruct.h" X#include "windowstr.h" X#include "window.h" X#include "pixmapstr.h" X#include "scrnintstr.h" X X#include "OScompiler.h" X X#include "ppc.h" X#include "ppcSpMcro.h" X X#include "x8514.h" X#include "ibmTrace.h" X Xextern int mergexlate[] ; Xextern int ibm8514cursorSemaphore ; Xextern int mfbGCPrivateIndex; X Xvoid Xibm8514SolidFS( pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) X DrawablePtr pDrawable ; X GCPtr pGC ; X int nInit ; /* number of spans to fill */ X DDXPointPtr pptInit ; /* pointer to list of start points */ X int *pwidthInit ; /* pointer to list of n widths */ X int fSorted ; X{ X register unsigned long int pm ; X register unsigned long int fg ; X register int alu ; X /* next three parameters are post-clip */ X int n ; /* number of spans to fill */ X register DDXPointPtr ppt ; /* pointer to list of start points */ X register int *pwidth ; /* pointer to list of n widths */ X int *pwidthFree ; /* copies of the pointers to free */ X DDXPointPtr pptFree ; X XTRACE(("ibm8514SolidFS((pDrawable = x%x, pGC = x%x, nInit = x%x, pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n", X pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted ) ) ; X X if ( pDrawable->depth == 1 ) X { X ErrorF("ibm8514SolidFS: depth == 1\n") ; X return ; X } X X if (pDrawable->type != DRAWABLE_WINDOW) X { X ErrorF("ibm8514SolidFS: not a window\n") ; X return ; X } X X if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop ) X return ; X X pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ; X fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fgPixel ; X X SETSPANPTRS( nInit, n, pwidthInit, pwidth, pptInit, X ppt, pwidthFree, pptFree, fSorted ) ; X X while ( n--) X { X if ( *pwidth ) X ibm8514DrawRectangle( fg, alu, pm, X ppt->x, ppt->y, *pwidth, 1 ) ; X ppt++ ; X pwidth++ ; X } X DEALLOCATE_LOCAL(pptFree) ; X DEALLOCATE_LOCAL(pwidthFree) ; X return ; X} X X#ifndef OLDFS Xvoid Xibm8514TileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) XDrawablePtr pDrawable ; XGC *pGC ; Xint nInit ; /* number of spans to fill */ XDDXPointPtr pptInit ; /* pointer to list of start points */ Xint *pwidthInit ; /* pointer to list of n widths */ Xint fSorted ; X{ X register unsigned long int pm ; X register int alu ; X /* next three parameters are post-clip */ X int n ; /* number of spans to fill */ X register DDXPointPtr ppt ; /* pointer to list of start points */ X register int *pwidth ; /* pointer to list of n widths */ X int *pwidthFree ; /* copies of the pointers to free */ X DDXPointPtr pptFree ; X PixmapPtr pTile ; X int xSrc, ySrc ; X int width ; X int tlx, tly, hoffset, voffset, hremaining ; X int currx ; X XTRACE(("ibm8514TileFS((pDrawable = x%x, pGC = x%x, nInit = %d, pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n", X pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ; X X if (pDrawable->type != DRAWABLE_WINDOW) X { X ErrorF("ibm8514TileFS: not a window\n") ; X return ; X } X X if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop ) X return ; X X pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ; X X SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, X ppt, pwidthFree, pptFree, fSorted) ; X X switch(alu) X { X while ( n--) X { X ibm8514DrawRectangle( 0xFF, alu, pm, X ppt->x, ppt->y, *pwidth, 1) ; X ppt++ ; X pwidth++ ; X } X return ; X break ; X } X X X xSrc = pGC->patOrg.x + pDrawable->x ; X ySrc = pGC->patOrg.y + pDrawable->y ; X X pTile= pGC->tile.pixmap ; X X tlx = pTile->drawable.width ; X tly = pTile->drawable.height ; X X if ( n == 1 ) { X unsigned char *data ; X X if ((hoffset = ((ppt->x-xSrc)%tlx)) < 0) hoffset += tlx ; X hremaining = tlx-hoffset ; X if ((voffset = ((ppt->y-ySrc)%tly)) < 0) voffset += tly ; X X data = pTile->devPrivate.ptr + voffset * pTile->devKind ; X width = *pwidth ; X X if ( hoffset ) { X unsigned char *tmp X = (unsigned char *) ALLOCATE_LOCAL(pTile->devKind) ; X MOVE( data + hoffset, tmp, hremaining) ; X if ( width > hremaining ) X MOVE( data, tmp + hremaining, X MIN( hoffset, width - hremaining ) ) ; X data = tmp ; X } X X if ( width <= tlx ) { X ibm8514DrawColorImage( ppt->x, ppt->y, width, 1, X data, width, alu, pm ) ; X } X else { X switch ( alu ) { X ibm8514DrawColorImage( ppt->x, ppt->y, X MIN( width, tlx ), 1, X data, X MIN( width, tlx ), X alu, pm) ; X ppcReplicateArea( ppt->x, ppt->y, X pm, width, 1, X tlx, 1, X pTile->drawable.pScreen ) ; X break ; X if ( tlx > MAXTILESIZE ) { X ibm8514DrawColorImage( X ppt->x, ppt->y, X MIN( width, tlx ), 1, X data, X MIN( width, tlx ), X alu, pm) ; X for ( X width -= tlx, X currx = ppt->x + tlx ; X width > 0 ; X currx += tlx, X width -= tlx X ) X ibm8514DrawColorImage( X currx, ppt->y, X MIN( width, tlx ), X 1, data, X MIN( width, tlx ), X alu, pm ) ; X } X else { X ibm8514DrawColorImage( X TILE_X, TILE_Y, X *pwidth, 1, X data, *pwidth, X alu, pm ) ; X while ( tlx << 1 <= MAXTILESIZE) X { X ibm8514Bitblt( X GXcopy, 0xFF, X 0xFF, X TILE_X, TILE_Y, X TILE_X + tlx, X TILE_Y, X tlx, 1 ) ; X tlx <<= 1 ; X } X for ( X currx = ppt->x ; X width > 0 ; X currx += tlx, X width -= tlx ) X ibm8514Bitblt( X alu, 0xFF, pm, X TILE_X, TILE_Y, X currx, ppt->y, X MIN( width, tlx ), X 1 ) ; X } X } /* end switch on rop */ X } /* end else on width > hremaining */ X } /* end N = 1 */ X else { X if ( ( tlx <= MAXTILESIZE ) && ( tly <= MAXTILESIZE ) ) { X X ibm8514DrawColorImage( X TILE_X, TILE_Y, X tlx, tly, X pTile->devPrivate.ptr, X pTile->devKind, X GXcopy, ibm8514ALLPLANES ) ; X /*we'll do the alu and planemask in the blits*/ X X while ( tlx << 1 <= MAXTILESIZE ) { X ibm8514Bitblt( X GXcopy, 0xff, 0xff, X TILE_X, TILE_Y, X TILE_X + tlx, TILE_Y, X tlx, tly ) ; X tlx <<= 1 ; X } X X while ( n-- ) { X if ( ( hoffset = ( ( ppt->x - xSrc ) % tlx ) ) < 0 ) X hoffset += pTile->drawable.width ; X if ( ( voffset = ( ( ppt->y - ySrc ) %tly ) ) < 0 ) X voffset += tly ; X X width = *pwidth ; X if ( hoffset ) { X ibm8514RotateTile( tlx, tly, hoffset, 0 ) ; X while ( width > 0 ) { X ibm8514Bitblt( alu, 0xff, pm, X ROTTILE_X, X ROTTILE_Y + voffset, X ppt->x, ppt->y, X MIN( width, tlx ), 1 ) ; X width -= tlx ; X ppt->x += tlx ; X } X } X else X while ( width > 0 ) { X ibm8514Bitblt( alu, 0xff, pm, X TILE_X, X TILE_Y + voffset, X ppt->x, ppt->y, X MIN( width, tlx ), 1 ) ; X width -= tlx ; X ppt->x += tlx ; X } X ppt++ ; X pwidth++ ; X } X } X else { X unsigned char *data ; X unsigned char *tmp X = (unsigned char *) ALLOCATE_LOCAL(pTile->devKind) ; X X while ( n-- ) { X if ( ( hoffset = ( ( ppt->x - xSrc ) % tlx ) ) < 0 ) X hoffset += tlx ; X hremaining = tlx-hoffset ; X if ( ( voffset = ( ( ppt->y - ySrc ) % tly ) ) < 0 ) X voffset += tly ; X X data = pTile->devPrivate.ptr + X voffset * pTile->devKind ; X X if ( hoffset ) { X MOVE( data + hoffset, tmp, hremaining ) ; X if ( *pwidth > hremaining ) X MOVE( data, tmp + hremaining, X hoffset ) ; X data = tmp ; X } X X while ( *pwidth > 0 ) { X ibm8514DrawColorImage( X ppt->x, ppt->y, X MIN( *pwidth, tlx ), 1, X data, X MIN( *pwidth, tlx ), X alu, pm ) ; X *pwidth -= tlx ; X ppt->x += tlx ; X } X ppt++ ; X pwidth++ ; X } X } X } /* end N > 1 */ X X DEALLOCATE_LOCAL(pptFree) ; X DEALLOCATE_LOCAL(pwidthFree) ; X return ; X} X#endif X#ifdef OLDFS Xvoid Xibm8514TileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) XDrawablePtr pDrawable ; XGC *pGC ; Xint nInit ; /* number of spans to fill */ XDDXPointPtr pptInit ; /* pointer to list of start points */ Xint *pwidthInit ; /* pointer to list of n widths */ Xint fSorted ; X{ X register unsigned long int pm ; X register int alu ; X /* next three parameters are post-clip */ X int n ; /* number of spans to fill */ X register DDXPointPtr ppt ; /* pointer to list of start points */ X register int *pwidth ; /* pointer to list of n widths */ X int *pwidthFree ; /* copies of the pointers to free */ X DDXPointPtr pptFree ; X PixmapPtr pTile ; X int xSrc, ySrc ; X XTRACE(("ibm8514TileFS((pDrawable = x%x, pGC = x%x, nInit = x%x, pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n", X pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ; X X if (pDrawable->depth == 1 ) X { X ErrorF("ibm8514TileFS: depth == 1\n") ; X return ; X } X X if (pDrawable->type != DRAWABLE_WINDOW) X { X ErrorF("ibm8514TileFS: not a window\n") ; X return ; X } X if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop ) X return ; X X pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ; X X SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, X ppt, pwidthFree, pptFree, fSorted) ; X X xSrc = pGC->patOrg.x ; X ySrc = pGC->patOrg.y ; X pTile= pGC->tile ; X X while (n--) X { X ibm8514TileRect(pTile,alu,pm,ppt->x,ppt->y,*pwidth,1,xSrc,ySrc) ; X ppt++ ; X pwidth++ ; X } X DEALLOCATE_LOCAL(pptFree) ; X DEALLOCATE_LOCAL(pwidthFree) ; X return ; X} X#endif X X/* Fill spans with stipples that aren't 32 bits wide */ Xvoid Xibm8514StippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) XDrawablePtr pDrawable ; XGC *pGC ; Xint nInit ; /* number of spans to fill */ XDDXPointPtr pptInit ; /* pointer to list of start points */ Xint *pwidthInit ; /* pointer to list of n widths */ Xint fSorted ; X{ X unsigned long int pm ; X unsigned long int fg ; X int alu ; X /* next three parameters are post-clip */ X int n ; /* number of spans to fill */ X register DDXPointPtr ppt ; /* pointer to list of start points */ X register int *pwidth ; /* pointer to list of n widths */ X int iline ; /* first line of stipple to use */ X PixmapPtr pStipple ; /* pointer to stipple we want to fill with */ X int xSrc, ySrc, stippleWidth, xshift, maxwidth, totlen, X saved = FALSE ; X X pointer data ; X int *pwidthFree ; /* copies of the pointers to free */ X DDXPointPtr pptFree ; X XTRACE(("ibm8514StippleFS((pDrawable = x%x, pGC = x%x, nInit = x%x, pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n", X pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ; X if ( pDrawable->depth != 8 ) X { X ErrorF("ibm8514StippleFS: depth != 8\n") ; X return ; X } X X if (pDrawable->type != DRAWABLE_WINDOW) X { X int dummy ; X dummy = (int) pDrawable->type ; X ErrorF("ibm8514StippleFS: x%x (=%d) not a window\n",dummy,dummy) ; X return ; X } X X if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop ) X return ; X X SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, X ppt, pwidthFree, pptFree, fSorted) ; X X pStipple = pGC->stipple ; X stippleWidth = pStipple->drawable.width ; X X /* this replaces rotating the stipple. Instead, we just adjust the offset X * at which we start grabbing bits from the stipple */ X xSrc = pGC->patOrg.x + pDrawable->x ; X ySrc = pGC->patOrg.y + pDrawable->y ; X X /* Grab From Pre-Calculated Storage */ X pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ; X fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fgPixel ; X X while (n--) X { X iline = (ppt->y - ySrc) % pStipple->drawable.height ; X maxwidth = _8514_SCREENWIDTH - ppt->x ; X *pwidth = MIN(*pwidth,maxwidth) ; X data = pStipple->devPrivate.ptr + iline*stippleWidth ; X X if ( !saved && !ibm8514cursorSemaphore ) X saved = ibm8514CheckCursor(ppt->x%xSrc,ppt->y, X *pwidth+stippleWidth,1) ; X /* I am only going to call replace ONCE, after the whole X stipple id done */ X X /* set up stipple off screen */ X xshift = (ppt->x - xSrc) % stippleWidth ; X ibm8514AlignMonoImage(WPLANE0, alu, X STIPX, STIPY+1, stippleWidth, 1, data) ; X if (xshift) X {/* shift the stipple left, then tack on end to the right */ X ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX+xshift,STIPY+1, X STIPX,STIPY,stippleWidth-xshift,1) ; X ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX,STIPY+1, X STIPX+stippleWidth-xshift,STIPY,xshift,1) ; X } X totlen = stippleWidth ; X while ( totlen<*pwidth) X { /* widen stipple to totlen of area to be stippled */ X ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0, X STIPX,STIPY,totlen,STIPY,totlen,1) ; X totlen += totlen ; X } X X X ibm8514ClearQueue( 2 ) ; X SETXMIN(ppt->x) ; /* use clip to draw stippled line */ X SETXMAX(*pwidth + ppt->x) ; X X ibm8514BlitFG(RPLANE0,pm,fg,alu, X STIPX,STIPY,ppt->x%xSrc,ppt->y,*pwidth+stippleWidth,1) ; X X ibm8514ClearQueue(2) ; X SETXMIN(0) ; X SETXMAX(_8514_SCREENWIDTH-1) ; X X ppt++ ; X pwidth++ ; X } X X DEALLOCATE_LOCAL(pptFree) ; X DEALLOCATE_LOCAL(pwidthFree) ; X if (saved) X ibm8514ReplaceCursor() ; X X return ; X} X X Xvoid Xibm8514OPStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted) XDrawablePtr pDrawable ; XGC *pGC ; Xint nInit ; /* number of spans to fill */ XDDXPointPtr pptInit ; /* pointer to list of start points */ Xint *pwidthInit ; /* pointer to list of n widths */ Xint fSorted ; X{ X unsigned long int pm ; X unsigned long int fg ; X unsigned long int bg ; X int alu ; X /* next three parameters are post-clip */ X int n ; /* number of spans to fill */ X register DDXPointPtr ppt ; /* pointer to list of start points */ X register int *pwidth ; /* pointer to list of n widths */ X int iline ; /* first line of stipple to use */ X PixmapPtr pStipple ; /* pointer to stipple we want to fill with */ X int xSrc, ySrc, stippleWidth, xshift, X maxwidth, totlen, saved = FALSE ; X pointer data ; X int *pwidthFree ; /* copies of the pointers to free */ X DDXPointPtr pptFree ; X XTRACE(("ibm8514StippleFS((pDrawable = x%x, pGC = x%x, nInit = x%x, pptInit = x%x, pwidthInit = x%x, fSorted = x%x)\n", X pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)) ; X if ( pDrawable->depth != 8 ) X { X ErrorF("ibm8514StippleFS: depth != 8\n") ; X return ; X } X X if (pDrawable->type != DRAWABLE_WINDOW) X { X int dummy ; X dummy = (int) pDrawable->type ; X ErrorF("ibm8514StippleFS: x%x (=%d) not a window\n",dummy,dummy) ; X return ; X } X X if ( ( alu = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.alu ) == GXnoop ) X return ; X X pm = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.planemask ; X fg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.fgPixel ; X bg = ( (ppcPrivGC *) pGC->devPrivates[mfbGCPrivateIndex].ptr )->colorRrop.bgPixel ; X X SETSPANPTRS(nInit, n, pwidthInit, pwidth, pptInit, X ppt, pwidthFree, pptFree, fSorted) ; X X pStipple = pGC->stipple ; X stippleWidth = pStipple->drawable.width ; X X /* this replaces rotating the stipple. Instead, we just adjust the offset X * at which we start grabbing bits from the stipple */ X xSrc = pGC->patOrg.x + pDrawable->x ; X ySrc = pGC->patOrg.y + pDrawable->y ; X X while (n--) X { X iline = (ppt->y - ySrc) % pStipple->drawable.height ; X maxwidth = _8514_SCREENWIDTH - ppt->x ; X *pwidth = MIN(*pwidth,maxwidth) ; X data = pStipple->devPrivate.ptr + iline*stippleWidth ; X X if ( !saved && !ibm8514cursorSemaphore ) X saved = ibm8514CheckCursor(ppt->x%xSrc,ppt->y, X *pwidth+stippleWidth,1) ; X /* I am only going to call replace ONCE, after the whole X stipple id done */ X X /* set up stipple off screen */ X xshift = (ppt->x - xSrc) % stippleWidth ; X ibm8514AlignMonoImage(WPLANE0,alu,STIPX,STIPY+1,stippleWidth,1,data) ; X if (xshift) X {/* shift the stipple left, then tack on end to the right */ X ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX+xshift,STIPY+1, X STIPX,STIPY,stippleWidth-xshift,1) ; X ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0,STIPX,STIPY+1, X STIPX+stippleWidth-xshift,STIPY,xshift,1) ; X } X X totlen = stippleWidth ; X while ( totlen<*pwidth) X { /* widen stipple to totlen of area to be stippled */ X ibm8514Bitblt(GXcopy,RPLANE0,WPLANE0, X STIPX,STIPY,totlen,STIPY,totlen,1) ; X totlen += totlen ; X } X X ibm8514ClearQueue( 2 ) ; X SETXMIN(ppt->x) ; /* use clip to draw stippled line */ X SETXMAX(*pwidth + ppt->x) ; X X ibm8514BlitFGBG(RPLANE0,pm,fg,bg,alu, X STIPX,STIPY,ppt->x%xSrc,ppt->y,*pwidth+stippleWidth,1) ; X X ibm8514ClearQueue(2) ; X SETXMIN(0) ; X SETXMAX(_8514_SCREENWIDTH-1) ; X X ppt++ ; X pwidth++ ; X } X X DEALLOCATE_LOCAL(pptFree) ; X DEALLOCATE_LOCAL(pwidthFree) ; X if (saved) X ibm8514ReplaceCursor() ; X X return ; X} END-of-ibm8514/brcFillSp.c echo x - ibm8514/brcFont.c sed 's/^X//' >ibm8514/brcFont.c << 'END-of-ibm8514/brcFont.c' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* X * Hardware interface routines for IBM 8514/A adapter for X * X.11 server(s) on IBM equipment. X * X */ X/* $Header: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcFont.c,v 30.2 89/02/28 18:16:03 paul Exp $ */ X/* $Source: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcFont.c,v $ */ X X#ifndef lint Xstatic char *rcsid = "$Header: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcFont.c,v 30.2 89/02/28 18:16:03 paul Exp $" ; X#endif X X/* Cached Font Manager X * X * Try to stuff a font off screen and remember where it is X * Always draw characters aligned to make life easy on the hardware X * If no room, leave for Image Glyph Blit X * When releasing, free up the space X * X */ X#include "X.h" X#include "Xproto.h" X#include "fontstruct.h" X#include "dixfontstr.h" X#include "dixfont.h" X#include "font.h" X#include "scrnintstr.h" X X#include "mfb.h" X X#include "OScompiler.h" X X#include "x8514.h" X X#include "brcFonts.h" X X#include "ibmTrace.h" X Xibm8514FontCacheRec ibm8514FontCacheEntry[NUMFONTPLANES] ; X Xvoid Xibm8514InitFontCache() X{ Xregister int i ; X XTRACE( ( "ibm8514InitFontCache()\n" ) ) ; X Xibm8514FontCacheEntry[0].RPlaneMask = RPLANE2 ; Xibm8514FontCacheEntry[0].WPlaneMask = WPLANE2 ; Xibm8514FontCacheEntry[1].RPlaneMask = RPLANE3 ; Xibm8514FontCacheEntry[1].WPlaneMask = WPLANE3 ; Xibm8514FontCacheEntry[2].RPlaneMask = RPLANE4 ; Xibm8514FontCacheEntry[2].WPlaneMask = WPLANE4 ; Xibm8514FontCacheEntry[3].RPlaneMask = RPLANE5 ; Xibm8514FontCacheEntry[3].WPlaneMask = WPLANE5 ; Xibm8514FontCacheEntry[4].RPlaneMask = RPLANE6 ; Xibm8514FontCacheEntry[4].WPlaneMask = WPLANE6 ; Xibm8514FontCacheEntry[5].RPlaneMask = RPLANE7 ; Xibm8514FontCacheEntry[5].WPlaneMask = WPLANE7 ; X Xfor ( i = 0 ; i < NUMFONTPLANES ; i++ ) X { X ibm8514FontCacheEntry[i].numInstalled = 0 ; X ibm8514FontCacheEntry[i].FirstAvailableLine = FONTCACHESTARTLINE ; X ibm8514FontCacheEntry[i].NumLinesAvailable = FONTCACHELENGTH ; X ibm8514FontCacheEntry[i].FontList = NULL ; X } Xreturn ; X} X Xextern int ibm8514NumberOfPlanes ; X Xvoid Xibm8514FreeFontChars( pChars, numChars ) Xregister InstalledCharPtr *pChars ; Xregister int numChars ; X{ Xregister InstalledCharPtr *pNextChar = pChars ; X Xwhile ( numChars-- ) X Xfree( *pNextChar++ ) ; XXfree( pChars ) ; X Xreturn ; X} X XBool Xibm8514RealizeFont( pscr, pFont ) X ScreenPtr pscr ; X FontPtr pFont ; X{ X FontInfoPtr pfi = pFont->pFI ; X CharInfoPtr maxb = &pfi->maxbounds ; X int lines, linesneeded, width, height, i, X numchars, firstchar, lastchar, found, X CacheEntries, destX, destY, glw, glh, X relativeY, wplane, padwidth ; X InstalledFontPtr ptr, pIFont ; X char *glyphs ; X CharInfoPtr pCinfo ; X X TRACE( ( "ibm8514RealizeFont: realizing 0x%x\n", pFont ) ) ; X X if ( pfi->lastRow == 0 ) { X numchars = n1dChars( pfi ) ; X firstchar = pfi->chFirst ; X lastchar = pfi->chLast ; X } X else { /* XXX This code needs to be looked at more XXX */ X numchars = n2dChars( pfi ) ; X pCinfo = pFont->pCI ; X for ( firstchar = -1, i = 0 ; X ( ( i < 0xFFFF ) && ( firstchar == -1 ) ) ; X i++ ) X if ( pCinfo[i].exists ) X firstchar = i ; X if ( ( i + numchars ) > 0xFFFF ) { X ErrorF("ibm8514RealizeFont: bad 16bit realize") ; X return mfbRealizeFont( pscr, pFont ) ; X } X lastchar = firstchar + numchars - 1 ; X } X X lines = 1 ; X width = 0 ; X height = GLYPHHEIGHTPIXELS( maxb ) ; X if ( GLYPHWIDTHPIXELS( maxb ) > FONTCACHEWIDTH ) { X ErrorF( "Xibm: 8514: Not enough cache space (wide glyph)...") ; X ErrorF( "Font was 0x%x\n", pFont ) ; X return mfbRealizeFont( pscr, pFont ) ; X } X X for ( i = 0 ; i < numchars ; i++ ) { X pCinfo = (CharInfoPtr) &(pFont->pCI[i]) ; X width += GLYPHWIDTHBYTES( pCinfo ) ; X if ( width > FONTCACHEBYTEWIDTH ) { X width = GLYPHWIDTHBYTES( pCinfo ) ; X lines++ ; X } X } X X linesneeded = lines * height ; X CacheEntries = ibm8514NumberOfPlanes - 2 ; /* 1 for stage, 1 for fill, */ X /* rest are for fonts */ X X for ( i = 0, found = -1 ; ( i < CacheEntries ) && ( found == -1 ) ; i++ ) X if ( linesneeded <= ibm8514FontCacheEntry[i].NumLinesAvailable ) X found = i ; X if ( found == -1 ) /* Can't find enough space !! */ X return mfbRealizeFont( pscr, pFont ) ; X X/* OK, we've space, we're going to go off-screen */ X pIFont = (InstalledFontRec *) Xalloc( sizeof (InstalledFontRec) ) ; X if ( !pIFont ) X { X ErrorF( "ibm8514RealizeFont: Cannot Xalloc for 0x%x\n", pFont ) ; X return mfbRealizeFont( pscr, pFont ) ; X } X pIFont->ppCharacter = X (InstalledCharPtr *) Xalloc( numchars * sizeof (InstalledCharPtr) ) ; X if ( !pIFont->ppCharacter ) X { X ErrorF( "ibm8514RealizeFont: Cannot Xalloc for 0x%x\n", pFont ) ; X Xfree( pIFont ) ; X return mfbRealizeFont( pscr, pFont ) ; X } X X pIFont->firstchar = firstchar ; X pIFont->lastchar = lastchar ; X pIFont->numchars = numchars ; X pIFont->CacheIndex = found ; X pIFont->cacheheight = linesneeded ; X X destX = 0 ; X relativeY = 0 ; X destY = pIFont->startline = X ibm8514FontCacheEntry[found].FirstAvailableLine ; X X /* allocate, install, fill chars */ X wplane = ibm8514FontCacheEntry[found].WPlaneMask ; X X for ( i = 0 ; i < numchars ; i++ ) { X pIFont->ppCharacter[i] = X (InstalledCharPtr) Xalloc( sizeof (InstalledCharRec) ) ; X if ( !(pIFont->ppCharacter[i]) ) { X ErrorF("ibm8514RealizeFont: Cannot Xalloc for 0x%x\n", pFont ) ; X ibm8514FreeFontChars( pIFont->ppCharacter, i ) ; X Xfree( pIFont ) ; X return mfbRealizeFont( pscr, pFont ) ; X } X X pCinfo = pIFont->ppCharacter[i]->pInfo = &(pFont->pCI[i]) ; X X if ( pCinfo->exists ) { X padwidth = 8 * GLYPHWIDTHBYTES( pCinfo ) ; X if ( destX + padwidth > FONTCACHEWIDTH ) { X destX = 0 ; X destY += height ; /* NEW LINE */ X relativeY += height ; X } X pIFont->ppCharacter[i]->x = destX ; X pIFont->ppCharacter[i]->y = relativeY ; X pIFont->ppCharacter[i]->w = glw = GLYPHWIDTHPIXELS( pCinfo ) ; X pIFont->ppCharacter[i]->h = glh = GLYPHHEIGHTPIXELS( pCinfo ) ; X glyphs = pFont->pGlyphs + pCinfo->byteOffset ; X TRACE( ( X"Font Realize align:pl=%d,destX=%d,destY=%d,glw=%d,glh=%d,glyphs=x%x,char=%d\n", X wplane, destX, destY, glw, glh, glyphs, i ) ) ; X X /* dont do zero width or height glyphs */ X if ( glw && glh ) X ibm8514ByteAlignMonoImage( wplane, GXcopy, destX, destY, X glw, glh, glyphs ) ; X destX += padwidth ; X } X } X X /* tack the Installed Font into the beginning of the fontlist */ X ptr = ibm8514FontCacheEntry[found].FontList ; X ibm8514FontCacheEntry[found].FontList = pIFont ; X pIFont->NextFont = ptr ; X X ibm8514FontCacheEntry[found].numInstalled++ ; X ibm8514FontCacheEntry[found].FirstAvailableLine += linesneeded ; X ibm8514FontCacheEntry[found].NumLinesAvailable -= linesneeded ; X X /* ok, so tell the world that it's been off-screened */ X pFont->devPriv[pscr->myNum] = (pointer) pIFont ; X pIFont->pFont = pFont ; X X return TRUE ; X} X XBool Xibm8514UnrealizeFont( pscr, pFont ) X ScreenPtr pscr ; X FontPtr pFont ; X{ Xint freeheight, blitheight, blitstart, blitdest ; XInstalledFontPtr currentfont, *lastfont, pIFont ; Xibm8514FontCachePtr pFC ; X XpIFont = (InstalledFontPtr) pFont->devPriv[pscr->myNum] ; X X/* this code depends on knowing what is going on in the mfb. I am assuming Xthat the mfbrealizefont routine will only store a 0,1,2 in the devPriv Xfield, whereas I store a pointer. In case the mfb grows, I will check Xthe field to see if it is a mfb number else assuming a pointer X*/ X Xswitch ( (long) pIFont ) { X return mfbUnrealizeFont( pscr, pFont ) ; X break ; /* It is an off-screen cached font ! */ X} X XTRACE( ( "ibm8514UnrealizeFont: unrealizing 0x%x\n", pFont ) ) ; X X/* Free the font's character's data in core */ Xibm8514FreeFontChars( pIFont->ppCharacter, pIFont->numchars ) ; X XpFC = (ibm8514FontCachePtr) &(ibm8514FontCacheEntry[pIFont->CacheIndex]) ; X Xfreeheight = pIFont->cacheheight ; Xblitstart = pIFont->startline+freeheight ; Xblitheight = 0 ; Xblitdest = pIFont->startline ; X Xcurrentfont = pFC->FontList ; Xlastfont = (InstalledFontPtr *) &(pFC->FontList) ; X/* notify all lower (earlier in list) fonts that they are moved up */ Xwhile ( currentfont != pIFont ) { X currentfont->startline -= freeheight ; X blitheight += currentfont->cacheheight ; X lastfont = (InstalledFontPtr *) &(currentfont->NextFont) ; X currentfont = currentfont->NextFont ; X} X/* move them up */ Xif ( blitheight ) X ibm8514Bitblt( GXcopy, pFC->RPlaneMask, pFC->WPlaneMask, X 0, blitstart, 0, blitdest, X FONTCACHEWIDTH, blitheight) ; X XpFC->FirstAvailableLine -= freeheight ; XpFC->NumLinesAvailable += freeheight ; XpFC->numInstalled-- ; X*lastfont = pIFont->NextFont ; XXfree( pIFont ) ; X Xreturn TRUE ; X} X X#ifdef FONTDUMP XFontDump( pscr, pFont ) X ScreenPtr pscr ; X FontPtr pFont ; X{ XInstalledFontPtr pIF ; Xibm8514FontCachePtr pFC ; X XpIF = (InstalledFontPtr) pFont->devPriv[pscr->myNum] ; XpFC = (ibm8514FontCachePtr) &(ibm8514FontCacheEntry[pIF->CacheIndex]) ; X XErrorF( "FontDump: 0x%x\n", pFont ) ; XErrorF( "InstalledFont:\n" ) ; XErrorF( "\tCacheIndex = %d\n", pIF->CacheIndex ) ; XErrorF( "\tstartline = %d\n", pIF->startline ) ; XErrorF( "\tcacheheight = %d\n", pIF->cacheheight ) ; XErrorF( "\tfirstchar = %d\n", pIF->firstchar ) ; XErrorF( "\tlastchar = %d\n", pIF->lastchar ) ; XErrorF( "\tnumchars = %d\n", pIF->numchars ) ; XErrorF( "\tNextFont = %x\n", pIF->NextFont ) ; X XErrorF( "CacheIndex:\n" ) ; XErrorF( "\tRplanemask, Wplanemask = %x, %x\n", X pFC->RPlaneMask,pFC->WPlaneMask ) ; XErrorF( "\tnumInstalled = %d\n", pFC->numInstalled ) ; XErrorF( "\tLinesAvail, First line = %d, %d\n", X pFC->FirstAvailableLine, pFC->NumLinesAvailable ) ; XErrorF( "\n" ) ; X} X#endif X X/* The X font from which it came */ Xstatic FontPtr *ibm8514SavedFontList = (FontPtr *) 0 ; Xstatic int ibm8514SavedfontCount = 0 ; X Xvoid Xibm8514CreateSavedFontList() X{ XInstalledFontPtr brcFonts ; XInstalledFontPtr nextInstalled ; Xint i ; Xint fontCount ; Xint tPcnt ; X XfontCount = 0 ; Xfor ( i = 0 ; i < NUMFONTPLANES ; i++ ) { X fontCount += ibm8514FontCacheEntry[i].numInstalled ; X ibm8514FontCacheEntry[i].FirstAvailableLine = FONTCACHESTARTLINE ; X ibm8514FontCacheEntry[i].NumLinesAvailable = FONTCACHELENGTH ; X} Xif ( !( ibm8514SavedFontList = X (FontPtr *) Xalloc( fontCount * sizeof (FontPtr) ) ) ) X return ; /* Blew It !! */ X Xibm8514SavedfontCount = 0 ; Xfor ( i = 0 ; i < NUMFONTPLANES ; i++ ) { X brcFonts = ibm8514FontCacheEntry[i].FontList ; X for ( tPcnt = ibm8514FontCacheEntry[i].numInstalled ; X tPcnt-- ; ) { X ibm8514SavedFontList[ibm8514SavedfontCount++] = X brcFonts->pFont ; X ibm8514FreeFontChars( brcFonts->ppCharacter, X brcFonts->numchars ) ; X nextInstalled = brcFonts->NextFont ; X Xfree( brcFonts ) ; X brcFonts = nextInstalled ; X } X ibm8514FontCacheEntry[i].numInstalled = 0 ; X ibm8514FontCacheEntry[i].FontList = NULL ; X} X Xreturn ; X} X Xvoid Xibm8514RestoreOffScreenFonts( pScr ) XScreenPtr pScr ; X{ XFontPtr *fontList = ibm8514SavedFontList ; X Xibm8514InitFontCache() ; Xwhile ( ibm8514SavedfontCount-- ) X ibm8514RealizeFont( pScr, *fontList++ ) ; X XXfree( ibm8514SavedFontList ) ; Xibm8514SavedFontList = (FontPtr *) 0 ; X Xreturn ; X} END-of-ibm8514/brcFont.c echo x - ibm8514/brcFonts.h sed 's/^X//' >ibm8514/brcFonts.h << 'END-of-ibm8514/brcFonts.h' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* X * Hardware interface routines for IBM 8514/A adapter for X * X.11 server(s) on IBM equipment. X * X */ X/* $Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcFonts.h,v 6.2 88/11/22 17:03:39 paul Exp $ */ X/* $Source: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcFonts.h,v $ */ X X#if !defined(lint) && !defined(LOCORE) && defined(RCS_HDRS) Xstatic char *rcsidibm8514fonts = "$Header: /andrew/X11/r3src/earlyRelease/server/ddx/ibm/ibm8514/RCS/brcFonts.h,v 6.2 88/11/22 17:03:39 paul Exp $" ; X#endif X Xtypedef struct _InstalledChar X { X unsigned short int x ; X unsigned short int y ; /* this is relative to the first cached line */ X unsigned short int w ; X unsigned short int h ; X CharInfoPtr pInfo ; X } InstalledCharRec, *InstalledCharPtr ; X Xtypedef struct _InstalledFont X { X unsigned short int CacheIndex ; X unsigned short int startline ; X unsigned short int cacheheight ; X unsigned short int firstchar ; X unsigned short int lastchar ; X unsigned short int numchars ; X InstalledCharPtr *ppCharacter ; X struct _InstalledFont *NextFont ; X FontPtr pFont ; /* The X font from which it came */ X } InstalledFontRec, *InstalledFontPtr ; X Xtypedef struct _ibm8514FontCacheEntry X { X unsigned long int RPlaneMask ; X unsigned long int WPlaneMask ; X int numInstalled ; X unsigned short int FirstAvailableLine ; X unsigned short int NumLinesAvailable ; X InstalledFontPtr FontList ; X } ibm8514FontCacheRec, *ibm8514FontCachePtr ; X X#define FONTCACHESTARTLINE 801 X#define FONTCACHELENGTH 222 X#define FONTCACHEWIDTH 1024 X#define FONTCACHEBYTEWIDTH 128 X#define NUMFONTPLANES 6 /* save 1 for stage, 1 for fill */ END-of-ibm8514/brcFonts.h echo x - ibm8514/brcGBlt.c sed 's/^X//' >ibm8514/brcGBlt.c << 'END-of-ibm8514/brcGBlt.c' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* X * Hardware interface routines for IBM 8514/A adapter for X * X.11 server(s) on IBM equipment. X * X */ X X/* $Header: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGBlt.c,v 30.0 89/01/23 19:23:37 paul Exp $ */ X/* $Source: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGBlt.c,v $ */ X X#ifndef lint Xstatic char *rcsid = "$Header: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGBlt.c,v 30.0 89/01/23 19:23:37 paul Exp $"; X#endif X X/* X * Image Glyph Blit X * For use when font cache is full X * X */ X X#include "X.h" X#include "Xmd.h" X#include "Xproto.h" X#include "fontstruct.h" X#include "dixfontstr.h" X#include "gcstruct.h" X#include "windowstr.h" X#include "scrnintstr.h" X#include "pixmapstr.h" X#include "regionstr.h" X X#include "OScompiler.h" X X#include "ppc.h" X X#include "x8514.h" X X#include "ibmTrace.h" X Xextern int ibm8514cursorSemaphore; Xextern int mfbGCPrivateIndex; X Xvoid Xibm8514ImageGlyphBlt( pDrawable, pGC, x, y, nglyph, ppci, pglyphBase) X DrawablePtr pDrawable; X GC *pGC; X int x, y; X unsigned int nglyph; X CharInfoPtr *ppci; /* array of character info */ X unsigned char *pglyphBase; /* start of array of glyphs */ X{ X int CursorIsSaved; X ExtentInfoRec info; /* used by QueryGlyphExtents() */ X BoxRec bbox; /* string's bounding box */ X xRectangle backrect;/* backing rectangle to paint. X in the general case, NOT necessarily X the same as the string's bounding box X */ X CharInfoPtr pci; X int xorg, yorg; /* origin of drawable in bitmap */ X int w; /* width of glyph in bits */ X int h; /* height of glyph */ X register unsigned char *pglyph; X /* pointer to current row of glyph */ X int nbox; X BoxPtr pbox; X int i ; X RegionPtr pRegion; X unsigned long int pm, bg, fg ; X int x0, y0 ; X X TRACE(("ibm8514ImageGlyphBlt( pDrawable = 0x%x, pGC = 0x%x, x=%d, y=%d, nglyph=%d, ppci= 0x%x, pglyphBase= 0x%x)\n", pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)); X if ( !( pGC->planemask & ibm8514ALLPLANES ) ) X return ; X X xorg = pDrawable->x; X yorg = pDrawable->y; X X QueryGlyphExtents(pGC->font, ppci, nglyph, &info); X X x += xorg; X y += yorg; X X backrect.x = x + info.overallLeft; X backrect.y = y - pGC->font->pFI->fontAscent; X backrect.width = info.overallRight - info.overallLeft; X backrect.width = MAX( backrect.width, info.overallWidth ); X backrect.height = pGC->font->pFI->fontAscent + X pGC->font->pFI->fontDescent; X X bbox.x1 = x + info.overallLeft; X bbox.x2 = x + info.overallRight; X bbox.y1 = y - info.overallAscent; X bbox.y2 = y + info.overallDescent; X X pRegion = ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip; X nbox = REGION_NUM_RECTS(pRegion); X if ( nbox == 0 ) X return; X X X pbox = REGION_RECTS(pRegion); X pm = pGC->planemask; X fg = pGC->fgPixel; X bg = pGC->bgPixel; X CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( backrect.x, backrect.y, backrect.width, backrect.height ); X for ( i = nbox ; i-- ; pbox++ ) { X ibm8514ClearQueue(4); X SETXMIN(pbox->x1); X SETYMIN(pbox->y1); X SETXMAX(pbox->x2-1); X SETYMAX(pbox->y2-1); X ibm8514DrawRectangle( bg, GXcopy, pm, X backrect.x, backrect.y, X backrect.width, backrect.height); X } X X ibm8514ClearQueue(4); X SETXMIN(0); X SETYMIN(0); X SETXMAX(_8514_SCREEN_WIDTH-1); X SETYMAX( 1023 ) ; X X if ( CursorIsSaved ) X ibm8514ReplaceCursor(); X X CursorIsSaved = !ibm8514cursorSemaphore && ibm8514CheckCursor( bbox.x1, bbox.y1, bbox.x2-bbox.x1, bbox.y2-bbox.y1 ); X X switch ( (*pGC->pScreen->RectIn)( X ( (ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &bbox ) ) X { X break; X X while (nglyph--) X { X pci = *ppci; X pglyph = pglyphBase + pci->byteOffset; X w = GLYPHWIDTHPIXELS(pci); X h = GLYPHHEIGHTPIXELS(pci); X x0 = x + pci->metrics.leftSideBearing; X y0 = y - pci->metrics.ascent; X /* draw offscreen */ X ibm8514ByteAlignMonoImage( MONO_STAGE_WPLANE, GXcopy, X MONO_STAGE_X, MONO_STAGE_Y, X w, h, pglyph ) ; X /* blit onscreen */ X ibm8514BlitFG( MONO_STAGE_RPLANE, pm, fg, GXcopy, X MONO_STAGE_X, MONO_STAGE_Y, x0, y0, w, h ) ; X X /* update character origin */ X x += pci->metrics.characterWidth; X ppci++; X } /* while nglyph-- */ X break; X { X int nbox; X BoxPtr pbox; X int i; X RegionPtr prgnClip; X BoxRec cbox; X int glx, gly; X X while (nglyph--) X { X pci = *ppci; X pglyph = pglyphBase + pci->byteOffset; X w = GLYPHWIDTHPIXELS(pci); X h = GLYPHHEIGHTPIXELS(pci); X cbox.x1 = glx = x + pci->metrics.leftSideBearing; X cbox.y1 = gly = y - pci->metrics.ascent; X cbox.x2 = cbox.x1 + w; X cbox.y2 = cbox.y1 + h; X X switch ((*pGC->pScreen->RectIn)( X ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip, &cbox)) X X { X break; X /* draw offscreen */ X ibm8514ByteAlignMonoImage( MONO_STAGE_WPLANE, GXcopy, X MONO_STAGE_X, MONO_STAGE_Y, X w, h, pglyph ) ; X /* blit onscreen */ X ibm8514BlitFG( MONO_STAGE_RPLANE, pm, fg, GXcopy, X MONO_STAGE_X, MONO_STAGE_Y, X glx, gly, w, h ) ; X break; X prgnClip = X (* ((WindowPtr)pDrawable)->drawable.pScreen->RegionCreate)( X &cbox, X REGION_NUM_RECTS(((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip)) ; X (* ((WindowPtr)pDrawable)->drawable.pScreen->Intersect) X ( prgnClip, prgnClip, X ((ppcPrivGC *)(pGC->devPrivates[mfbGCPrivateIndex].ptr))->pCompositeClip ) ; X if ( !( nbox = REGION_NUM_RECTS(prgnClip) ) ) X break; X pbox = REGION_RECTS(prgnClip); X /* draw offscreen */ X ibm8514ByteAlignMonoImage( MONO_STAGE_WPLANE, GXcopy, X MONO_STAGE_X, MONO_STAGE_Y, X w, h, pglyph ) ; X/* ****** THIS STINKS & MUST BE FIXED SOMEDAY -- SOON ****** */ X for ( i = nbox ; i-- ; pbox++ ) { X ibm8514ClearQueue( 4 ) ; X SETXMIN(pbox->x1); X SETYMIN(pbox->y1); X SETXMAX(pbox->x2-1); X SETYMAX(pbox->y2-1); X /* blit onscreen*/ X ibm8514BlitFG( MONO_STAGE_RPLANE, pm, fg, GXcopy, X MONO_STAGE_X, MONO_STAGE_Y, X glx, gly, w, h ) ; XTRACE(("gbltPARTPART: call BlitFG: x=%d, y=%d, w=%d, h=%d\n", glx,gly,w,h)); X } X X (* ((WindowPtr)pDrawable)->drawable.pScreen->RegionDestroy) X (prgnClip); X ibm8514ClearQueue( 4 ); X SETXMIN(0); X SETYMIN(0); X SETXMAX(_8514_SCREEN_WIDTH-1); X SETYMAX( 1023 ) ; X break; X } X /* update character origin */ X x += pci->metrics.characterWidth; X ppci++; X } /* while nglyph-- */ X X } X break; X } X X if ( CursorIsSaved ) X ibm8514ReplaceCursor(); X return ; X} END-of-ibm8514/brcGBlt.c echo x - ibm8514/brcGC.c sed 's/^X//' >ibm8514/brcGC.c << 'END-of-ibm8514/brcGC.c' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* X * Hardware interface routines for IBM 8514/A adapter for X * X.11 server(s) on IBM equipment. X * X */ X X/*********************************************************** XCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, Xand the Massachusetts Institute of Technology, Cambridge, Massachusetts. X X All Rights Reserved X XPermission to use, copy, modify, and distribute this software and its Xdocumentation for any purpose and without fee is hereby granted, Xprovided that the above copyright notice appear in all copies and that Xboth that copyright notice and this permission notice appear in Xsupporting documentation, and that the names of Digital or MIT not be Xused in advertising or publicity pertaining to distribution of the Xsoftware without specific, written prior permission. X XDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING XALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL XDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR XANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, XWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, XARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS XSOFTWARE. X X******************************************************************/ X X/* $Header: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcGC.c,v 6.12 89/07/06 13:55:40 jeff Exp $ */ X/* $Source: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcGC.c,v $ */ X X#ifndef lint Xstatic char *rcsid = "$Header: /andrew/X11/r3src/r3plus/server/ddx/ibm/ibm8514/RCS/brcGC.c,v 6.12 89/07/06 13:55:40 jeff Exp $" ; X#endif X X#include "X.h" X#include "Xproto.h" X#include "windowstr.h" X#include "window.h" X#include "pixmapstr.h" X#include "scrnintstr.h" X#include "misc.h" X#include "font.h" X#include "gcstruct.h" X#include "cursorstr.h" X#include "region.h" X X#include "mistruct.h" X X#include "../../mfb/mfb.h" X X#include "OScompiler.h" X X#include "ppc.h" X#include "ppcProcs.h" X X#include "brcProcs.h" X#include "ibmTrace.h" X X#ifdef Use8514HardwareDashes Xextern void ibm8514ZeroDash() ; /* will be .h */ X#endif X Xextern void miWideLine() ; Xextern int mfbGCPrivateIndex; X XMask Xibm8514ChangeGCtype( pGC, devPriv ) Xregister GC *pGC ; Xregister ppcPrivGCPtr devPriv ; X{ X if ( devPriv->lastDrawableType == DRAWABLE_PIXMAP ) { X devPriv->FillArea = mfbSolidInvertArea ; X pGC->ops->CopyArea = miCopyArea ; X pGC->ops->PolyFillRect = miPolyFillRect ; X pGC->ops->FillPolygon = miFillPolygon ; X pGC->ops->ImageText8 = miImageText8 ; X pGC->ops->ImageText16 = miImageText16 ; X pGC->ops->PolyText8 = miPolyText8 ; X pGC->ops->PolyText16 = miPolyText16 ; X pGC->ops->PushPixels = miPushPixels ; X pGC->ops->PolyGlyphBlt = miPolyGlyphBlt ; X pGC->ops->PolyArc = miPolyArc ; X pGC->ops->PolyFillArc = miPolyFillArc ; X pGC->ops->PolySegment = miPolySegment ; X pGC->ops->PolyRectangle = miPolyRectangle ; X } X else { X devPriv->FillArea = ppcAreaFill ; X pGC->ops->CopyArea = ppcCopyArea ; X pGC->ops->PolyFillRect = ppcPolyFillRect ; X pGC->ops->FillPolygon = ibm8514FillPolygon ; X pGC->ops->ImageText8 = (void (*)()) ibm8514ImageText8 ; X pGC->ops->ImageText16 = (void (*)()) ibm8514ImageText16 ; X pGC->ops->PolyText8 = ibm8514PolyText8 ; X pGC->ops->PolyText16 = ibm8514PolyText16 ; X pGC->ops->PushPixels = ibm8514PushPixels ; X pGC->ops->PolyGlyphBlt = ppcPolyGlyphBlt ; X } X return; X} X XMask Xibm8514ChangeWindowGC( pGC, changes ) Xregister GC *pGC ; Xregister Mask changes ; X{ Xregister ppcPrivGCPtr devPriv = (ppcPrivGCPtr) (pGC->devPrivates[mfbGCPrivateIndex].ptr) ; Xregister unsigned long int index ; /* used for stepping through bitfields */ Xregister Mask bsChanges = 0 ; X X#define LOWBIT( x ) ( x & - x ) /* Two's complement */ X while ( index = LOWBIT( changes ) ) { X switch ( index ) { X X if ( pGC->lineStyle == LineSolid ) { X pGC->ops->PolySegment = ( ( pGC->lineWidth == 0 ) X ? ppcScrnZeroSegs : miPolySegment ) ; X pGC->ops->Polylines = ( ( pGC->lineWidth == 0 ) X ? ppcScrnZeroLine : miWideLine ) ; X pGC->ops->PolyArc = ( ( pGC->lineWidth == 0 ) X ? ppcPolyZeroArc : miPolyArc ) ; X } X else { X pGC->ops->PolySegment = miPolySegment; X#ifdef Use8514HardwareDashes X if ( pGC->lineWidth == 0 ) { X extern void ibm8514_do_dashline_gc() ; X ibm8514_do_dashline_gc( pGC ) ; X } X else { X pGC->ops->Polylines = miWideDash ; X } X#else X pGC->ops->Polylines = ( pGC->lineWidth == 0 ) X ? ppcScrnZeroDash : miWideDash ; X#endif X pGC->ops->PolyArc = miPolyArc; X } X /* X * If these are just square boxes with no funny business X * going on we can call the fast routine that draws X * rectangles without floating point. X */ X if ( ( pGC->lineStyle == LineSolid ) X && ( pGC->joinStyle == JoinMiter ) X && ( pGC->lineWidth != 0 ) ) X pGC->ops->PolyRectangle = ppcPolyRectangle; X else X pGC->ops->PolyRectangle = miPolyRectangle; X X changes &= ~( GCLineStyle | GCLineWidth ) ; X break ; X pGC->ops->LineHelper = X ( pGC->joinStyle == JoinMiter ) ? miMiter : miNotMiter ; X /* X * If these are just square boxes with no funny business X * going on we can call the fast routine that draws X * rectangles without floating point. X */ X if ( ( pGC->lineStyle == LineSolid ) X && ( pGC->joinStyle == JoinMiter ) X && ( pGC->lineWidth != 0 ) ) X pGC->ops->PolyRectangle = ppcPolyRectangle; X else X pGC->ops->PolyRectangle = miPolyRectangle; X changes &= ~ index ; /* i.e. changes &= ~ GCJoinStyle */ X break ; X X if ( pGC->fillStyle != FillOpaqueStippled ) { X changes &= ~ index ; /* i.e. changes &= ~GCBackground */ X break ; X } /* else Fall Through */ X if ( pGC->fillStyle == FillTiled ) { X changes &= ~ index ; /* i.e. changes &= ~GCForeground */ X break ; X } /* else Fall Through */ X { /* new_fill */ X int fillStyle = devPriv->colorRrop.fillStyle ; X /* install a suitable fillspans */ X if ( fillStyle == FillSolid ) X pGC->ops->FillSpans = ibm8514SolidFS ; X else if ( fillStyle == FillStippled ) X pGC->ops->FillSpans = ppcStippleWindowFS ; X else if ( fillStyle == FillOpaqueStippled ) X pGC->ops->FillSpans = ppcOpStippleWindowFS ; X else /* fillStyle == FillTiled */ X pGC->ops->FillSpans = ibm8514TileFS ; X pGC->ops->PolyFillArc = ppcPolyFillArc; X } /* end of new_fill */ X changes &= ~( GCBackground | GCForeground X | GCFunction X | GCPlaneMask | GCFillStyle ) ; X break ; X X ErrorF( "ibm8514ValidateGC: Unexpected GC Change\n" ) ; X changes &= ~ index ; /* Remove it anyway */ X break ; X } X } X return bsChanges ; X} END-of-ibm8514/brcGC.c echo x - ibm8514/brcGetSp.c sed 's/^X//' >ibm8514/brcGetSp.c << 'END-of-ibm8514/brcGetSp.c' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* $Header: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGetSp.c,v 6.3 89/02/14 22:23:05 paul Exp $ */ X/* $Source: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGetSp.c,v $ */ X X#ifndef lint Xstatic char *rcsid = "$Header: /andrew/X11/r3src/release/server/ddx/ibm/ibm8514/RCS/brcGetSp.c,v 6.3 89/02/14 22:23:05 paul Exp $" ; X#endif X X#include "X.h" X#include "Xmd.h" X X#include "region.h" X#include "gc.h" X#include "windowstr.h" X#include "pixmapstr.h" X#include "scrnintstr.h" X#include "servermd.h" X X#include "ibmTrace.h" X Xextern void ppcGetSpans() ; X Xvoid Xibm8514GetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) X DrawablePtr pDrawable ; X int wMax ; X register DDXPointPtr ppt ; X int *pwidth ; X int nspans ; X unsigned long int *pdstStart ; X{ X register unsigned int *pdst ; /* where to put the bits */ X register unsigned int width ; X X if ( pDrawable->type != DRAWABLE_WINDOW ) X { X ppcGetSpans( pDrawable, wMax, ppt, pwidth, nspans, pdstStart ) ; X return ; X } X X/*******************************************************************/ X /* read back the slices */ X for ( pdst = pdstStart ; nspans-- ; ppt++, pwidth++ ) { X width = *pwidth ; X ibm8514ReadColorImage( ppt->x, ppt->y, width, 1, pdst, X ( width + 3 ) & ~3 ) ; X pdst += ( width + 3 ) >> 2 ; /* width is in 32 bit words */ X } X/*******************************************************************/ X X return ; X} END-of-ibm8514/brcGetSp.c echo x - ibm8514/brcIO.c sed 's/^X//' >ibm8514/brcIO.c << 'END-of-ibm8514/brcIO.c' X/* X * Copyright IBM Corporation 1987,1990 X * X * All Rights Reserved X * X * Permission to use, copy, modify, and distribute this software and its X * documentation for any purpose and without fee is hereby granted, X * provided that the above copyright notice appear in all copies and that X * both that copyright notice and this permission notice appear in X * supporting documentation, and that the name of IBM not be X * used in advertising or publicity pertaining to distribution of the X * software without specific, written prior permission. X * X * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL X * IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR X * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS X * SOFTWARE. X * X*/ X/* X * PRPQ 5799-PFF (C) COPYRIGHT IBM CORPORATION 1987,1990 X * LICENSED MATERIALS - PROPERTY OF IBM X * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083 X */ X/* X * Hardware interface routines for IBM 8514/A adapter for X * X.11 server(s) on IBM equipment. X * X */ X X/* $Header: brcIO.c,v 1.1 89/11/14 13:25:53 keith Exp $ */ X/* $Source: /users/keith/X/ibm8514/RCS/brcIO.c,v $ */ X X#ifndef lint Xstatic char *rcsid = "$Header: brcIO.c,v 1.1 89/11/14 13:25:53 keith Exp $" ; X#endif X X#include "X.h" X#include "servermd.h" X#include "screenint.h" X#include "scrnintstr.h" X#include "pixmapstr.h" X#include "miscstruct.h" X#include "window.h" X#include "windowstr.h" X#include "colormap.h" X#include "colormapst.h" X#include "resource.h" X X#include "ibmScreen.h" X X#include "ppc.h" X X#include "x8514.h" X X#include "ibmTrace.h" X Xint ibm8514HeadInstalled = HEAD_NONE ; Xint ibm8514NumberOfPlanes = IBM8514MAXPLANES ; X X/********************************************************************** ********/ X Xstatic int ibm8514Generation = 0 ; X X/* Declared in "ibm8514Data.c" */ Xextern GC ibm8514PrototypeGC ; Xextern ScreenRec ibm8514ScreenRec ; Xextern ppcScrnPriv ibm8514ScrnPriv ; Xextern VisualRec ibm8514Visuals[] ; Xextern DepthRec ibm8514Depths[] ; Xextern unsigned long ibm8514DepthVIDs[]; Xextern PixmapFormatRec ibm8514Formats[] ; X XBool Xibm8514ScreenInit( index, pScreen, argc, argv ) Xregister const int index ; Xregister ScreenPtr const pScreen ; Xregister int const argc ; /* these two may NOT be changed */ Xregister char * const * const argv ; X{ X int i; X TRACE( ( "ibm8514ScreenInit(index=%d,pScreen=0x%x,argc=%d,argv=0x%x)\n", X index, pScreen, argc, argv ) ) ; X X if ( ibm8514Generation != serverGeneration ) { X for (i = 0; i < ibm8514ScreenRec.numVisuals; i++) X { X ibm8514DepthVIDs[i] = X ibm8514Visuals[i].vid = FakeClientID(0); X } X ibm8514ScreenRec.rootVisual = ibm8514Visuals[0].vid; X if ( ( ibm8514NumberOfPlanes = ibm8514ScreenInitHW( index ) ) X != 8 ) { X ibm8514PrototypeGC.planemask = X ( ibm8514Visuals[0].ColormapEntries = X 1 << ( ibm8514Visuals[0].nplanes = X ibm8514Formats[0].depth = X ibm8514Depths[1].depth = X ibm8514ScreenRec.rootDepth = X ibm8514ScrnPriv.pixmap.drawable.depth = X ibm8514PrototypeGC.depth = X ibm8514NumberOfPlanes ) ) - 1 ; X } X ibm8514ScrnPriv.pixmap.devKind = X PixmapBytePad( _8514_SCREEN_WIDTH, X ibm8514NumberOfPlanes ) ; X ibm8514Visuals[0].class = ibm8514QueryHead() ; X ibm8514Generation = serverGeneration; X } X /* Magic Hardware Initialization */ X ibm8514outw( ibm8514_MiscIO, 0x0005 ) ; X X ppcCommonScreenInit( pScreen, index, &ibm8514ScreenRec ) ; X X ibm8514CursorInit( index ) ; X ibm8514InitFontCache() ; X X /* we MIGHT return 0 if we had been keeping track of potential X allocation failures. one day someone will clean this up. X */ X return 1 ; X} X X/*ARGSUSED*/ XBool Xibm8514ScreenClose( index, pScreen ) Xregister const int index ; Xregister ScreenPtr const pScreen ; X{ XTRACE( ( "ibm8514ScreenClose(index=%d,pScreen=0x%x)\n", index, pScreen ) ) ; XppcCommonScreenClose( pScreen, index, &ibm8514ScreenRec ) ; Xif ( ibm8514Generation == serverGeneration ) { X ibm8514outw( ibm8514_MiscIO, 0 ) ; /* reset 'miscio' */ X} X Xreturn TRUE ; X} END-of-ibm8514/brcIO.c exit