diff options
Diffstat (limited to 'nx-X11/programs/Xserver/miext/rootless/accel')
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/Imakefile | 30 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.c | 155 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.h | 141 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlBlt.c | 370 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlCopy.c | 107 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlFill.c | 221 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlFillRect.c | 118 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlFillSpans.c | 106 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlGlyph.c | 170 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/miext/rootless/accel/rlSolid.c | 112 |
10 files changed, 1530 insertions, 0 deletions
diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/Imakefile b/nx-X11/programs/Xserver/miext/rootless/accel/Imakefile new file mode 100644 index 000000000..a3dabe64b --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/Imakefile @@ -0,0 +1,30 @@ +XCOMM $XFree86: xc/programs/Xserver/miext/rootless/safeAlpha/Imakefile,v 1.1 2003/09/16 00:36:20 torrey Exp $ + +#include <Server.tmpl> + +SRCS = rlAccel.c \ + rlBlt.c \ + rlCopy.c \ + rlFill.c \ + rlFillRect.c \ + rlFillSpans.c \ + rlGlyph.c \ + rlSolid.c + +OBJS = rlAccel.o \ + rlBlt.o \ + rlCopy.o \ + rlFill.o \ + rlFillRect.o \ + rlFillSpans.o \ + rlGlyph.o \ + rlSolid.o + +INCLUDES = -I. -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(SERVERSRC)/include \ + -I$(XINCLUDESRC) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ + -I$(EXTINCSRC) -I$(SERVERSRC)/Xext -I.. + +NormalLibraryObjectRule() +LibraryModuleTarget(rlAccel,$(OBJS)) + +DependTarget() diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.c new file mode 100644 index 000000000..9977c9e4a --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.c @@ -0,0 +1,155 @@ +/* + * Support for accelerated rootless code + */ +/* + * Copyright (c) 2004 Torrey T. Lyons. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + */ +/* $XdotOrg: xc/programs/Xserver/miext/rootless/accel/rlAccel.c,v 1.5 2005/07/03 07:02:03 daniels Exp $ */ + +/* + * The accelerated rootless code replaces some GC operations from fb with + * versions that call the rootless acceleration functions where appropriate. + * To work properly, this must be wrapped directly on top of fb. Nothing + * underneath this layer besides fb will get called. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "rootless.h" +#include "rlAccel.h" + +typedef struct _rlAccelScreenRec { + CreateGCProcPtr CreateGC; + CloseScreenProcPtr CloseScreen; +} rlAccelScreenRec, *rlAccelScreenPtr; + +static int rlAccelScreenPrivateIndex = -1; + +#define RLACCELREC(pScreen) \ + ((rlAccelScreenRec *)(pScreen)->devPrivates[rlAccelScreenPrivateIndex].ptr) + +/* This is mostly identical to fbGCOps. */ +static GCOps rlAccelOps = { + rlFillSpans, + fbSetSpans, + fbPutImage, + rlCopyArea, + fbCopyPlane, + fbPolyPoint, + fbPolyLine, + fbPolySegment, + fbPolyRectangle, + fbPolyArc, + miFillPolygon, + rlPolyFillRect, + fbPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + rlImageGlyphBlt, + fbPolyGlyphBlt, + fbPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + + +/* + * Screen function to create a graphics context + */ +static Bool +rlCreateGC(GCPtr pGC) +{ + ScreenPtr pScreen = pGC->pScreen; + rlAccelScreenRec *s = RLACCELREC(pScreen); + Bool result; + + // Unwrap and call + pScreen->CreateGC = s->CreateGC; + result = s->CreateGC(pGC); + + // Accelerated GC ops replace some fb GC ops + pGC->ops = &rlAccelOps; + + // Rewrap + s->CreateGC = pScreen->CreateGC; + pScreen->CreateGC = rlCreateGC; + + return result; +} + + +/* + * Clean up when closing a screen on server reset + */ +static Bool +rlCloseScreen (int iScreen, ScreenPtr pScreen) +{ + rlAccelScreenRec *s = RLACCELREC(pScreen); + Bool result; + + // Unwrap + pScreen->CloseScreen = s->CloseScreen; + result = pScreen->CloseScreen(iScreen, pScreen); + + xfree(s); + + return result; +} + + +/* + * RootlessAccelInit + * Called by the rootless implementation to initialize accelerated + * rootless drawing. + */ +Bool +RootlessAccelInit(ScreenPtr pScreen) +{ + static unsigned long rlAccelGeneration = 0; + rlAccelScreenRec *s; + + if (rlAccelGeneration != serverGeneration) { + rlAccelScreenPrivateIndex = AllocateScreenPrivateIndex(); + if (rlAccelScreenPrivateIndex == -1) return FALSE; + rlAccelGeneration = serverGeneration; + } + + s = xalloc(sizeof(rlAccelScreenRec)); + if (!s) return FALSE; + RLACCELREC(pScreen) = s; + + // Wrap the screen functions we need + s->CreateGC = pScreen->CreateGC; + pScreen->CreateGC = rlCreateGC; + s->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = rlCloseScreen; + + return TRUE; +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.h b/nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.h new file mode 100644 index 000000000..a4402bdf2 --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlAccel.h @@ -0,0 +1,141 @@ +/* + * Rootless Acceleration Code + */ +/* + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + */ +/* $XFree86: xc/programs/Xserver/miext/rootless/rootlessCommon.c,v 1.4 2003/10/18 00:00:34 torrey Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" + +/* + * rlBlt.c + */ +void +rlBlt (FbBits *srcLine, + FbStride srcStride, + int srcX, + + ScreenPtr pDstScreen, + FbBits *dstLine, + FbStride dstStride, + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + int bpp, + + Bool reverse, + Bool upsidedown); + +/* + * rlCopy.c + */ +RegionPtr +rlCopyArea (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + int xIn, + int yIn, + int widthSrc, + int heightSrc, + int xOut, + int yOut); + +/* + * rlFill.c + */ +void +rlFill (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + int width, + int height); + +void +rlSolidBoxClipped (DrawablePtr pDrawable, + RegionPtr pClip, + int x1, + int y1, + int x2, + int y2, + FbBits and, + FbBits xor); + +/* + * rlFillRect.c + */ +void +rlPolyFillRect(DrawablePtr pDrawable, + GCPtr pGC, + int nrect, + xRectangle *prect); + +/* + * rlFillSpans.c + */ +void +rlFillSpans (DrawablePtr pDrawable, + GCPtr pGC, + int n, + DDXPointPtr ppt, + int *pwidth, + int fSorted); + +/* + * rlGlyph.c + */ +void +rlImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + pointer pglyphBase); + +/* + * rlSolid.c + */ +void +rlSolid (ScreenPtr pScreen, + FbBits *dst, + FbStride dstStride, + int dstX, + int bpp, + + int width, + int height, + + FbBits and, + FbBits xor); diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlBlt.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlBlt.c new file mode 100644 index 000000000..e5fa5f7bd --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlBlt.c @@ -0,0 +1,370 @@ +/* + * Accelerated rootless blit + */ +/* + * This code is largely copied from fbBlt.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbblt.c,v 1.8 2000/09/28 00:47:22 keithp Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include "rootlessCommon.h" +#include "rlAccel.h" + + +void +rlBlt (FbBits *srcLine, + FbStride srcStride, + int srcX, + + ScreenPtr pDstScreen, + FbBits *dstLine, + FbStride dstStride, + int dstX, + + int width, + int height, + + int alu, + FbBits pm, + int bpp, + + Bool reverse, + Bool upsidedown) +{ + FbBits *src, *dst; + int leftShift, rightShift; + FbBits startmask, endmask; + FbBits bits, bits1; + int n, nmiddle; + Bool destInvarient; + int startbyte, endbyte; + FbDeclareMergeRop (); + +#ifdef FB_24BIT + if (bpp == 24 && !FbCheck24Pix (pm)) + { + fbBlt24 (srcLine, srcStride, srcX, dstLine, dstStride, dstX, + width, height, alu, pm, reverse, upsidedown); + return; + } +#endif + FbInitializeMergeRop(alu, pm); + destInvarient = FbDestInvarientMergeRop(); + if (upsidedown) + { + srcLine += (height - 1) * (srcStride); + dstLine += (height - 1) * (dstStride); + srcStride = -srcStride; + dstStride = -dstStride; + } + FbMaskBitsBytes (dstX, width, destInvarient, startmask, startbyte, + nmiddle, endmask, endbyte); + + /* + * Beginning of the rootless acceleration code + */ + if (!startmask && !endmask && alu == GXcopy && + height * nmiddle * sizeof(*dst) > rootless_CopyBytes_threshold) + { + if (pm == FB_ALLONES && SCREENREC(pDstScreen)->imp->CopyBytes) + { + SCREENREC(pDstScreen)->imp->CopyBytes( + nmiddle * sizeof(*dst), height, + (char *) srcLine + (srcX >> 3), + srcStride * sizeof (*src), + (char *) dstLine + (dstX >> 3), + dstStride * sizeof (*dst)); + return; + } + + /* FIXME: the pm test here isn't super-wonderful - just because + we don't care about the top eight bits doesn't necessarily + mean we want them set to 255. But doing this does give a + factor of two performance improvement when copying from a + pixmap to a window, which is pretty common.. */ + + else if (bpp == 32 && sizeof(FbBits) == 4 && + pm == 0x00FFFFFFUL && !reverse && + SCREENREC(pDstScreen)->imp->CompositePixels) + { + /* need to copy XRGB to ARGB. */ + + void *src[2], *dest[2]; + unsigned int src_rowbytes[2], dest_rowbytes[2]; + unsigned int fn; + + src[0] = (char *) srcLine + (srcX >> 3); + src[1] = NULL; + src_rowbytes[0] = srcStride * sizeof(*src); + src_rowbytes[1] = 0; + + dest[0] = (char *) dstLine + (dstX >> 3); + dest[1] = dest[0]; + dest_rowbytes[0] = dstStride * sizeof(*dst); + dest_rowbytes[1] = dest_rowbytes[0]; + + fn = RL_COMPOSITE_FUNCTION(RL_COMPOSITE_SRC, RL_DEPTH_ARGB8888, + RL_DEPTH_NIL, RL_DEPTH_ARGB8888); + + if (SCREENREC(pDstScreen)->imp->CompositePixels( + nmiddle, height, + fn, src, src_rowbytes, + NULL, 0, dest, dest_rowbytes) == Success) + { + return; + } + } + } + /* End of the rootless acceleration code */ + + if (reverse) + { + srcLine += ((srcX + width - 1) >> FB_SHIFT) + 1; + dstLine += ((dstX + width - 1) >> FB_SHIFT) + 1; + srcX = (srcX + width - 1) & FB_MASK; + dstX = (dstX + width - 1) & FB_MASK; + } + else + { + srcLine += srcX >> FB_SHIFT; + dstLine += dstX >> FB_SHIFT; + srcX &= FB_MASK; + dstX &= FB_MASK; + } + if (srcX == dstX) + { + while (height--) + { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + if (reverse) + { + if (endmask) + { + bits = *--src; + --dst; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + n = nmiddle; + if (destInvarient) + { + while (n--) + *--dst = FbDoDestInvarientMergeRop(*--src); + } + else + { + while (n--) + { + bits = *--src; + --dst; + *dst = FbDoMergeRop (bits, *dst); + } + } + if (startmask) + { + bits = *--src; + --dst; + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + } + } + else + { + if (startmask) + { + bits = *src++; + FbDoLeftMaskByteMergeRop(dst, bits, startbyte, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) + { +#if 0 + /* + * This provides some speedup on screen->screen blts + * over the PCI bus, usually about 10%. But fb + * isn't usually used for this operation... + */ + if (_ca2 + 1 == 0 && _cx2 == 0) + { + FbBits t1, t2, t3, t4; + while (n >= 4) + { + t1 = *src++; + t2 = *src++; + t3 = *src++; + t4 = *src++; + *dst++ = t1; + *dst++ = t2; + *dst++ = t3; + *dst++ = t4; + n -= 4; + } + } +#endif + while (n--) + *dst++ = FbDoDestInvarientMergeRop(*src++); + } + else + { + while (n--) + { + bits = *src++; + *dst = FbDoMergeRop (bits, *dst); + dst++; + } + } + if (endmask) + { + bits = *src; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + } + } + } + else + { + if (srcX > dstX) + { + leftShift = srcX - dstX; + rightShift = FB_UNIT - leftShift; + } + else + { + rightShift = dstX - srcX; + leftShift = FB_UNIT - rightShift; + } + while (height--) + { + src = srcLine; + srcLine += srcStride; + dst = dstLine; + dstLine += dstStride; + + bits1 = 0; + if (reverse) + { + if (srcX < dstX) + bits1 = *--src; + if (endmask) + { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(endmask, leftShift)) + { + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + FbDoRightMaskByteMergeRop(dst, bits, endbyte, endmask); + } + n = nmiddle; + if (destInvarient) + { + while (n--) + { + bits = FbScrRight(bits1, rightShift); + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + --dst; + *dst = FbDoDestInvarientMergeRop(bits); + } + } + else + { + while (n--) + { + bits = FbScrRight(bits1, rightShift); + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + --dst; + *dst = FbDoMergeRop(bits, *dst); + } + } + if (startmask) + { + bits = FbScrRight(bits1, rightShift); + if (FbScrRight(startmask, leftShift)) + { + bits1 = *--src; + bits |= FbScrLeft(bits1, leftShift); + } + --dst; + FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); + } + } + else + { + if (srcX > dstX) + bits1 = *src++; + if (startmask) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + FbDoLeftMaskByteMergeRop (dst, bits, startbyte, startmask); + dst++; + } + n = nmiddle; + if (destInvarient) + { + while (n--) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoDestInvarientMergeRop(bits); + dst++; + } + } + else + { + while (n--) + { + bits = FbScrLeft(bits1, leftShift); + bits1 = *src++; + bits |= FbScrRight(bits1, rightShift); + *dst = FbDoMergeRop(bits, *dst); + dst++; + } + } + if (endmask) + { + bits = FbScrLeft(bits1, leftShift); + if (FbScrLeft(endmask, rightShift)) + { + bits1 = *src; + bits |= FbScrRight(bits1, rightShift); + } + FbDoRightMaskByteMergeRop (dst, bits, endbyte, endmask); + } + } + } + } +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlCopy.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlCopy.c new file mode 100644 index 000000000..ccea7fbd3 --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlCopy.c @@ -0,0 +1,107 @@ +/* + * This code is largely copied from fbcopy.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbcopy.c,v 1.12 2001/07/16 05:04:05 keithp Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include "rlAccel.h" + + +void +rlCopyNtoN (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + CARD8 alu = pGC ? pGC->alu : GXcopy; + FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES; + FbBits *src; + FbStride srcStride; + int srcBpp; + int srcXoff, srcYoff; + FbBits *dst; + FbStride dstStride; + int dstBpp; + int dstXoff, dstYoff; + + fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff); + fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + + while (nbox--) + { + rlBlt (src + (pbox->y1 + dy + srcYoff) * srcStride, + srcStride, + (pbox->x1 + dx + srcXoff) * srcBpp, + + pDstDrawable->pScreen, + dst + (pbox->y1 + dstYoff) * dstStride, + dstStride, + (pbox->x1 + dstXoff) * dstBpp, + + (pbox->x2 - pbox->x1) * dstBpp, + (pbox->y2 - pbox->y1), + + alu, + pm, + dstBpp, + + reverse, + upsidedown); + pbox++; + } +} + +RegionPtr +rlCopyArea (DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + int xIn, + int yIn, + int widthSrc, + int heightSrc, + int xOut, + int yOut) +{ + fbCopyProc copy; + +#ifdef FB_24_32BIT + if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel) + copy = fb24_32CopyMtoN; + else +#endif + copy = rlCopyNtoN; + return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn, + widthSrc, heightSrc, xOut, yOut, copy, 0, 0); +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlFill.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlFill.c new file mode 100644 index 000000000..a6ed2fbbb --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlFill.c @@ -0,0 +1,221 @@ +/* + * This code is largely copied from fbfill.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbfill.c,v 1.6 2003/01/31 00:01:45 torrey Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include "rlAccel.h" + + +void +rlFill (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + int width, + int height) +{ + FbBits *dst; + FbStride dstStride; + int dstBpp; + int dstXoff, dstYoff; + FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); + + fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + + switch (pGC->fillStyle) { + case FillSolid: + rlSolid (pDrawable->pScreen, + dst + (y + dstYoff) * dstStride, + dstStride, + (x + dstXoff) * dstBpp, + dstBpp, + width * dstBpp, height, + pPriv->and, pPriv->xor); + break; + case FillStippled: + case FillOpaqueStippled: { + PixmapPtr pStip = pGC->stipple; + int stipWidth = pStip->drawable.width; + int stipHeight = pStip->drawable.height; + + if (dstBpp == 1) + { + int alu; + FbBits *stip; + FbStride stipStride; + int stipBpp; + int stipXoff, stipYoff; /* XXX assumed to be zero */ + + if (pGC->fillStyle == FillStippled) + alu = FbStipple1Rop(pGC->alu,pGC->fgPixel); + else + alu = FbOpaqueStipple1Rop(pGC->alu,pGC->fgPixel,pGC->bgPixel); + fbGetDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); + fbTile (dst + (y + dstYoff) * dstStride, + dstStride, + x + dstXoff, + width, height, + stip, + stipStride, + stipWidth, + stipHeight, + alu, + pPriv->pm, + dstBpp, + + (pGC->patOrg.x + pDrawable->x + dstXoff), + pGC->patOrg.y + pDrawable->y + dstYoff - y); + } + else + { + FbStip *stip; + FbStride stipStride; + int stipBpp; + int stipXoff, stipYoff; /* XXX assumed to be zero */ + FbBits fgand, fgxor, bgand, bgxor; + + fgand = pPriv->and; + fgxor = pPriv->xor; + if (pGC->fillStyle == FillStippled) + { + bgand = fbAnd(GXnoop,(FbBits) 0,FB_ALLONES); + bgxor = fbXor(GXnoop,(FbBits) 0,FB_ALLONES); + } + else + { + bgand = pPriv->bgand; + bgxor = pPriv->bgxor; + } + + fbGetStipDrawable (&pStip->drawable, stip, stipStride, stipBpp, stipXoff, stipYoff); + fbStipple (dst + (y + dstYoff) * dstStride, + dstStride, + (x + dstXoff) * dstBpp, + dstBpp, + width * dstBpp, height, + stip, + stipStride, + stipWidth, + stipHeight, + pPriv->evenStipple, + fgand, fgxor, + bgand, bgxor, + pGC->patOrg.x + pDrawable->x + dstXoff, + pGC->patOrg.y + pDrawable->y + dstYoff - y); + } + break; + } + case FillTiled: { + PixmapPtr pTile = pGC->tile.pixmap; + FbBits *tile; + FbStride tileStride; + int tileBpp; + int tileWidth; + int tileHeight; + int tileXoff, tileYoff; /* XXX assumed to be zero */ + + fbGetDrawable (&pTile->drawable, tile, tileStride, tileBpp, tileXoff, tileYoff); + tileWidth = pTile->drawable.width; + tileHeight = pTile->drawable.height; + fbTile (dst + (y + dstYoff) * dstStride, + dstStride, + (x + dstXoff) * dstBpp, + width * dstBpp, height, + tile, + tileStride, + tileWidth * tileBpp, + tileHeight, + pGC->alu, + pPriv->pm, + dstBpp, + (pGC->patOrg.x + pDrawable->x + dstXoff) * dstBpp, + pGC->patOrg.y + pDrawable->y + dstYoff - y); + break; + } + } + fbValidateDrawable (pDrawable); +} + +void +rlSolidBoxClipped (DrawablePtr pDrawable, + RegionPtr pClip, + int x1, + int y1, + int x2, + int y2, + FbBits and, + FbBits xor) +{ + FbBits *dst; + FbStride dstStride; + int dstBpp; + int dstXoff, dstYoff; + BoxPtr pbox; + int nbox; + int partX1, partX2, partY1, partY2; + + fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + + for (nbox = REGION_NUM_RECTS(pClip), pbox = REGION_RECTS(pClip); + nbox--; + pbox++) + { + partX1 = pbox->x1; + if (partX1 < x1) + partX1 = x1; + + partX2 = pbox->x2; + if (partX2 > x2) + partX2 = x2; + + if (partX2 <= partX1) + continue; + + partY1 = pbox->y1; + if (partY1 < y1) + partY1 = y1; + + partY2 = pbox->y2; + if (partY2 > y2) + partY2 = y2; + + if (partY2 <= partY1) + continue; + + rlSolid (pDrawable->pScreen, + dst + (partY1 + dstYoff) * dstStride, + dstStride, + (partX1 + dstXoff) * dstBpp, + dstBpp, + + (partX2 - partX1) * dstBpp, + (partY2 - partY1), + and, xor); + } +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlFillRect.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlFillRect.c new file mode 100644 index 000000000..e4bab4f53 --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlFillRect.c @@ -0,0 +1,118 @@ +/* + * This code is largely copied from fbfillrect.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbfillrect.c,v 1.2 2000/02/23 20:29:43 dawes Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include "rlAccel.h" + + +void +rlPolyFillRect(DrawablePtr pDrawable, + GCPtr pGC, + int nrect, + xRectangle *prect) +{ + RegionPtr pClip = fbGetCompositeClip(pGC); + register BoxPtr pbox; + BoxPtr pextent; + int extentX1, extentX2, extentY1, extentY2; + int fullX1, fullX2, fullY1, fullY2; + int partX1, partX2, partY1, partY2; + int xorg, yorg; + int n; + + xorg = pDrawable->x; + yorg = pDrawable->y; + + pextent = REGION_EXTENTS(pGC->pScreen, pClip); + extentX1 = pextent->x1; + extentY1 = pextent->y1; + extentX2 = pextent->x2; + extentY2 = pextent->y2; + while (nrect--) + { + fullX1 = prect->x + xorg; + fullY1 = prect->y + yorg; + fullX2 = fullX1 + (int) prect->width; + fullY2 = fullY1 + (int) prect->height; + prect++; + + if (fullX1 < extentX1) + fullX1 = extentX1; + + if (fullY1 < extentY1) + fullY1 = extentY1; + + if (fullX2 > extentX2) + fullX2 = extentX2; + + if (fullY2 > extentY2) + fullY2 = extentY2; + + if ((fullX1 >= fullX2) || (fullY1 >= fullY2)) + continue; + n = REGION_NUM_RECTS (pClip); + if (n == 1) + { + rlFill (pDrawable, + pGC, + fullX1, fullY1, fullX2-fullX1, fullY2-fullY1); + } + else + { + pbox = REGION_RECTS(pClip); + /* + * clip the rectangle to each box in the clip region + * this is logically equivalent to calling Intersect() + */ + while(n--) + { + partX1 = pbox->x1; + if (partX1 < fullX1) + partX1 = fullX1; + partY1 = pbox->y1; + if (partY1 < fullY1) + partY1 = fullY1; + partX2 = pbox->x2; + if (partX2 > fullX2) + partX2 = fullX2; + partY2 = pbox->y2; + if (partY2 > fullY2) + partY2 = fullY2; + + pbox++; + + if (partX1 < partX2 && partY1 < partY2) + rlFill (pDrawable, pGC, + partX1, partY1, + partX2 - partX1, partY2 - partY1); + } + } + } +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlFillSpans.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlFillSpans.c new file mode 100644 index 000000000..9942d70e4 --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlFillSpans.c @@ -0,0 +1,106 @@ +/* + * This code is largely copied from fbfillsp.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbfillsp.c,v 1.2 2000/02/23 20:29:43 dawes Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include "rlAccel.h" + + +void +rlFillSpans (DrawablePtr pDrawable, + GCPtr pGC, + int n, + DDXPointPtr ppt, + int *pwidth, + int fSorted) +{ + RegionPtr pClip = fbGetCompositeClip(pGC); + BoxPtr pextent, pbox; + int nbox; + int extentX1, extentX2, extentY1, extentY2; + int fullX1, fullX2, fullY1; + int partX1, partX2; + + pextent = REGION_EXTENTS(pGC->pScreen, pClip); + extentX1 = pextent->x1; + extentY1 = pextent->y1; + extentX2 = pextent->x2; + extentY2 = pextent->y2; + while (n--) + { + fullX1 = ppt->x; + fullY1 = ppt->y; + fullX2 = fullX1 + (int) *pwidth; + ppt++; + pwidth++; + + if (fullY1 < extentY1 || extentY2 <= fullY1) + continue; + + if (fullX1 < extentX1) + fullX1 = extentX1; + + if (fullX2 > extentX2) + fullX2 = extentX2; + + if (fullX1 >= fullX2) + continue; + + nbox = REGION_NUM_RECTS (pClip); + if (nbox == 1) + { + rlFill (pDrawable, + pGC, + fullX1, fullY1, fullX2-fullX1, 1); + } + else + { + pbox = REGION_RECTS(pClip); + while(nbox--) + { + if (pbox->y1 <= fullY1 && fullY1 < pbox->y2) + { + partX1 = pbox->x1; + if (partX1 < fullX1) + partX1 = fullX1; + partX2 = pbox->x2; + if (partX2 > fullX2) + partX2 = fullX2; + if (partX2 > partX1) + { + rlFill (pDrawable, pGC, + partX1, fullY1, + partX2 - partX1, 1); + } + } + pbox++; + } + } + } +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlGlyph.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlGlyph.c new file mode 100644 index 000000000..3f1571963 --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlGlyph.c @@ -0,0 +1,170 @@ +/* + * This code is largely copied from fbglyph.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbglyph.c,v 1.12 2001/09/07 15:16:00 keithp Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include <X11/fonts/fontstruct.h> +#include "dixfontstr.h" +#include "rlAccel.h" + + +void +rlImageGlyphBlt (DrawablePtr pDrawable, + GCPtr pGC, + int x, + int y, + unsigned int nglyph, + CharInfoPtr *ppciInit, + pointer pglyphBase) +{ + FbGCPrivPtr pPriv = fbGetGCPrivate(pGC); + CharInfoPtr *ppci; + CharInfoPtr pci; + unsigned char *pglyph; /* pointer bits in glyph */ + int gWidth, gHeight; /* width and height of glyph */ + FbStride gStride; /* stride of glyph */ + Bool opaque; + int n; + int gx, gy; +#ifndef FBNOPIXADDR + void (*glyph) (FbBits *, + FbStride, + int, + FbStip *, + FbBits, + int, + int); + FbBits *dst = 0; + FbStride dstStride = 0; + int dstBpp = 0; + int dstXoff = 0, dstYoff = 0; + + glyph = 0; + if (pPriv->and == 0) + { + fbGetDrawable (pDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff); + switch (dstBpp) { + case 8: glyph = fbGlyph8; break; + case 16: glyph = fbGlyph16; break; +#ifdef FB_24BIT + case 24: glyph = fbGlyph24; break; +#endif + case 32: glyph = fbGlyph32; break; + } + } +#endif + + x += pDrawable->x; + y += pDrawable->y; + + if (TERMINALFONT (pGC->font) +#ifndef FBNOPIXADDR + && !glyph +#endif + ) + { + opaque = TRUE; + } + else + { + int xBack, widthBack; + int yBack, heightBack; + + ppci = ppciInit; + n = nglyph; + widthBack = 0; + while (n--) + widthBack += (*ppci++)->metrics.characterWidth; + + xBack = x; + if (widthBack < 0) + { + xBack += widthBack; + widthBack = -widthBack; + } + yBack = y - FONTASCENT(pGC->font); + heightBack = FONTASCENT(pGC->font) + FONTDESCENT(pGC->font); + rlSolidBoxClipped (pDrawable, + fbGetCompositeClip(pGC), + xBack, + yBack, + xBack + widthBack, + yBack + heightBack, + fbAnd(GXcopy,pPriv->bg,pPriv->pm), + fbXor(GXcopy,pPriv->bg,pPriv->pm)); + opaque = FALSE; + } + + ppci = ppciInit; + while (nglyph--) + { + pci = *ppci++; + pglyph = FONTGLYPHBITS(pglyphBase, pci); + gWidth = GLYPHWIDTHPIXELS(pci); + gHeight = GLYPHHEIGHTPIXELS(pci); + if (gWidth && gHeight) + { + gx = x + pci->metrics.leftSideBearing; + gy = y - pci->metrics.ascent; +#ifndef FBNOPIXADDR + if (glyph && gWidth <= sizeof (FbStip) * 8 && + fbGlyphIn (fbGetCompositeClip(pGC), gx, gy, gWidth, gHeight)) + { + (*glyph) (dst + (gy + dstYoff) * dstStride, + dstStride, + dstBpp, + (FbStip *) pglyph, + pPriv->fg, + gx + dstXoff, + gHeight); + } + else +#endif + { + gStride = GLYPHWIDTHBYTESPADDED(pci) / sizeof (FbStip); + fbPutXYImage (pDrawable, + fbGetCompositeClip(pGC), + pPriv->fg, + pPriv->bg, + pPriv->pm, + GXcopy, + opaque, + + gx, + gy, + gWidth, gHeight, + + (FbStip *) pglyph, + gStride, + 0); + } + } + x += pci->metrics.characterWidth; + } +} diff --git a/nx-X11/programs/Xserver/miext/rootless/accel/rlSolid.c b/nx-X11/programs/Xserver/miext/rootless/accel/rlSolid.c new file mode 100644 index 000000000..edce3d2c4 --- /dev/null +++ b/nx-X11/programs/Xserver/miext/rootless/accel/rlSolid.c @@ -0,0 +1,112 @@ +/* + * Accelerated rootless fill + */ +/* + * This code is largely copied from fbsolid.c. + * + * Copyright © 1998 Keith Packard + * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the name of Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ +/* $XFree86: xc/programs/Xserver/fb/fbsolid.c,v 1.8 2001/10/28 03:33:08 tsi Exp $ */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "fb.h" +#include "rootlessCommon.h" + + +void +rlSolid (ScreenPtr pScreen, + FbBits *dst, + FbStride dstStride, + int dstX, + int bpp, + + int width, + int height, + + FbBits and, + FbBits xor) +{ + FbBits startmask, endmask; + int n, nmiddle; + int startbyte, endbyte; + +#ifdef FB_24BIT + if (bpp == 24 && (!FbCheck24Pix(and) || !FbCheck24Pix(xor))) + { + fbSolid24 (dst, dstStride, dstX, width, height, and, xor); + return; + } +#endif + + dst += dstX >> FB_SHIFT; + dstX &= FB_MASK; + FbMaskBitsBytes(dstX, width, and == 0, startmask, startbyte, + nmiddle, endmask, endbyte); + + /* + * Beginning of the rootless acceleration code + */ + if (!startmask && !endmask && !and && + height * nmiddle * sizeof (*dst) > rootless_FillBytes_threshold && + SCREENREC(pScreen)->imp->FillBytes) + { + if (bpp <= 8) + xor |= xor << 8; + if (bpp <= 16) + xor |= xor << 16; + + SCREENREC(pScreen)->imp->FillBytes(nmiddle * sizeof (*dst), height, + xor, (char *) dst + (dstX >> 3), + dstStride * sizeof (*dst)); + return; + } + /* End of the rootless acceleration code */ + + if (startmask) + dstStride--; + dstStride -= nmiddle; + while (height--) + { + if (startmask) + { + FbDoLeftMaskByteRRop(dst,startbyte,startmask,and,xor); + dst++; + } + n = nmiddle; + if (!and) + while (n--) + *dst++ = xor; + else + while (n--) + { + *dst = FbDoRRop (*dst, and, xor); + dst++; + } + if (endmask) + FbDoRightMaskByteRRop(dst,endbyte,endmask,and,xor); + dst += dstStride; + } +} |