aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xfree86/xaa
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-05-16 20:50:58 +0000
committermarha <marha@users.sourceforge.net>2010-05-16 20:50:58 +0000
commit1c94119ae26b94a60bb2c2b33494ed43c3b8a52f (patch)
treecfe0c736c95314edac7d9f1065be9c13026ed0c1 /xorg-server/hw/xfree86/xaa
parent6b29aa4559aeb6f795caee047561654bfa0a1954 (diff)
downloadvcxsrv-1c94119ae26b94a60bb2c2b33494ed43c3b8a52f.tar.gz
vcxsrv-1c94119ae26b94a60bb2c2b33494ed43c3b8a52f.tar.bz2
vcxsrv-1c94119ae26b94a60bb2c2b33494ed43c3b8a52f.zip
svn merge -r588:HEAD ^/branches/released .
Diffstat (limited to 'xorg-server/hw/xfree86/xaa')
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaBitBlt.c442
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyArea.c774
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyPlane.c416
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaCpyWin.c164
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaGC.c1312
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaImage.c1042
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInit.c1248
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaInitAccel.c2996
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaLineMisc.c302
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaNonTEText.c1182
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOffscreen.c324
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOverlay.c258
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaOverlayDF.c2100
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaPCache.c4760
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaPict.c1310
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaStateChange.c3252
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEGlyph.c2154
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaTEText.c624
-rw-r--r--xorg-server/hw/xfree86/xaa/xaaWrapper.c948
-rw-r--r--xorg-server/hw/xfree86/xaa/xaalocal.h3510
20 files changed, 14559 insertions, 14559 deletions
diff --git a/xorg-server/hw/xfree86/xaa/xaaBitBlt.c b/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
index ebba74e55..b1fda1cd6 100644
--- a/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
+++ b/xorg-server/hw/xfree86/xaa/xaaBitBlt.c
@@ -1,221 +1,221 @@
-
-/*
- This is a lighter version of cfbBitBlt. We calculate the boxes
- when accelerating pixmap->screen and screen->screen copies.
- We also pass the GC to the doBitBlt function so that it has access
- to the fg and bg so CopyPlane can use this.
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "mi.h"
-#include "pixmapstr.h"
-#include "gcstruct.h"
-#include "windowstr.h"
-#include "xaalocal.h"
-
-
-RegionPtr
-XAABitBlt(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
- unsigned long bitPlane )
-{
-
- RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
- RegionPtr prgnExposed;
- Bool freeSrcClip = FALSE;
- RegionRec rgnDst;
- DDXPointPtr pptSrc, ppt;
- DDXPointRec origDest;
- BoxPtr pbox;
- BoxRec fastBox;
- int i, dx, dy, numRects;
- xRectangle origSource;
- int fastClip = 0; /* for fast clipping with pixmap source */
- int fastExpose = 0; /* for fast exposures with pixmap source */
-
- origSource.x = srcx;
- origSource.y = srcy;
- origSource.width = width;
- origSource.height = height;
- origDest.x = dstx;
- origDest.y = dsty;
-
- if((pSrcDrawable != pDstDrawable) &&
- pSrcDrawable->pScreen->SourceValidate) {
- (*pSrcDrawable->pScreen->SourceValidate) (
- pSrcDrawable, srcx, srcy, width, height);
- }
-
- srcx += pSrcDrawable->x;
- srcy += pSrcDrawable->y;
-
- /* clip the source */
- if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
- if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
- prgnSrcClip = pGC->pCompositeClip;
- else
- fastClip = 1;
- } else { /* Window */
- if (pGC->subWindowMode == IncludeInferiors) {
- if (!((WindowPtr) pSrcDrawable)->parent) {
- /*
- * special case bitblt from root window in
- * IncludeInferiors mode; just like from a pixmap
- */
- fastClip = 1;
- } else if ((pSrcDrawable == pDstDrawable) &&
- (pGC->clientClipType == CT_NONE)) {
- prgnSrcClip = pGC->pCompositeClip;
- } else {
- prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
- freeSrcClip = TRUE;
- }
- } else {
- prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
- }
- }
-
- fastBox.x1 = srcx;
- fastBox.y1 = srcy;
- fastBox.x2 = srcx + width;
- fastBox.y2 = srcy + height;
-
- /* Don't create a source region if we are doing a fast clip */
- if (fastClip) {
- fastExpose = 1;
- /*
- * clip the source; if regions extend beyond the source size,
- * make sure exposure events get sent
- */
- if (fastBox.x1 < pSrcDrawable->x) {
- fastBox.x1 = pSrcDrawable->x;
- fastExpose = 0;
- }
- if (fastBox.y1 < pSrcDrawable->y) {
- fastBox.y1 = pSrcDrawable->y;
- fastExpose = 0;
- }
- if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
- fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
- fastExpose = 0;
- }
- if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
- fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
- fastExpose = 0;
- }
- } else {
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
- }
-
- dstx += pDstDrawable->x;
- dsty += pDstDrawable->y;
-
- if (pDstDrawable->type == DRAWABLE_WINDOW) {
- if (!((WindowPtr)pDstDrawable)->realized) {
- if (!fastClip)
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return NULL;
- }
- }
-
- dx = srcx - dstx;
- dy = srcy - dsty;
-
- /* Translate and clip the dst to the destination composite clip */
- if (fastClip) {
- RegionPtr cclip;
-
- /* Translate the region directly */
- fastBox.x1 -= dx;
- fastBox.x2 -= dx;
- fastBox.y1 -= dy;
- fastBox.y2 -= dy;
-
- /* If the destination composite clip is one rectangle we can
- do the clip directly. Otherwise we have to create a full
- blown region and call intersect */
-
- cclip = pGC->pCompositeClip;
- if (REGION_NUM_RECTS(cclip) == 1) {
- BoxPtr pBox = REGION_RECTS(cclip);
-
- if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
- if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
- if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
- if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
-
- /* Check to see if the region is empty */
- if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
- REGION_NULL(pGC->pScreen, &rgnDst);
- } else {
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
- }
- } else {
- /* We must turn off fastClip now, since we must create
- a full blown region. It is intersected with the
- composite clip below. */
- fastClip = 0;
- REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
- }
- } else {
- REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
- }
-
- if (!fastClip) {
- REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
- pGC->pCompositeClip);
- }
-
- /* Do bit blitting */
- numRects = REGION_NUM_RECTS(&rgnDst);
- if (numRects && width && height) {
- if(!(pptSrc = (DDXPointPtr)xalloc(numRects *
- sizeof(DDXPointRec)))) {
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return NULL;
- }
- pbox = REGION_RECTS(&rgnDst);
- ppt = pptSrc;
- for (i = numRects; --i >= 0; pbox++, ppt++) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
- xfree(pptSrc);
- }
-
- prgnExposed = NULL;
- if (pGC->fExpose) {
- /* Pixmap sources generate a NoExposed (we return NULL to do this) */
- if (!fastExpose)
- prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
- origSource.x, origSource.y,
- (int)origSource.width,
- (int)origSource.height,
- origDest.x, origDest.y, bitPlane);
- }
- REGION_UNINIT(pGC->pScreen, &rgnDst);
- if (freeSrcClip)
- REGION_DESTROY(pGC->pScreen, prgnSrcClip);
- return prgnExposed;
-}
+
+/*
+ This is a lighter version of cfbBitBlt. We calculate the boxes
+ when accelerating pixmap->screen and screen->screen copies.
+ We also pass the GC to the doBitBlt function so that it has access
+ to the fg and bg so CopyPlane can use this.
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "mi.h"
+#include "pixmapstr.h"
+#include "gcstruct.h"
+#include "windowstr.h"
+#include "xaalocal.h"
+
+
+RegionPtr
+XAABitBlt(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
+ unsigned long bitPlane )
+{
+
+ RegionPtr prgnSrcClip = NULL; /* may be a new region, or just a copy */
+ RegionPtr prgnExposed;
+ Bool freeSrcClip = FALSE;
+ RegionRec rgnDst;
+ DDXPointPtr pptSrc, ppt;
+ DDXPointRec origDest;
+ BoxPtr pbox;
+ BoxRec fastBox;
+ int i, dx, dy, numRects;
+ xRectangle origSource;
+ int fastClip = 0; /* for fast clipping with pixmap source */
+ int fastExpose = 0; /* for fast exposures with pixmap source */
+
+ origSource.x = srcx;
+ origSource.y = srcy;
+ origSource.width = width;
+ origSource.height = height;
+ origDest.x = dstx;
+ origDest.y = dsty;
+
+ if((pSrcDrawable != pDstDrawable) &&
+ pSrcDrawable->pScreen->SourceValidate) {
+ (*pSrcDrawable->pScreen->SourceValidate) (
+ pSrcDrawable, srcx, srcy, width, height);
+ }
+
+ srcx += pSrcDrawable->x;
+ srcy += pSrcDrawable->y;
+
+ /* clip the source */
+ if (pSrcDrawable->type == DRAWABLE_PIXMAP) {
+ if ((pSrcDrawable == pDstDrawable) && (pGC->clientClipType == CT_NONE))
+ prgnSrcClip = pGC->pCompositeClip;
+ else
+ fastClip = 1;
+ } else { /* Window */
+ if (pGC->subWindowMode == IncludeInferiors) {
+ if (!((WindowPtr) pSrcDrawable)->parent) {
+ /*
+ * special case bitblt from root window in
+ * IncludeInferiors mode; just like from a pixmap
+ */
+ fastClip = 1;
+ } else if ((pSrcDrawable == pDstDrawable) &&
+ (pGC->clientClipType == CT_NONE)) {
+ prgnSrcClip = pGC->pCompositeClip;
+ } else {
+ prgnSrcClip = NotClippedByChildren((WindowPtr)pSrcDrawable);
+ freeSrcClip = TRUE;
+ }
+ } else {
+ prgnSrcClip = &((WindowPtr)pSrcDrawable)->clipList;
+ }
+ }
+
+ fastBox.x1 = srcx;
+ fastBox.y1 = srcy;
+ fastBox.x2 = srcx + width;
+ fastBox.y2 = srcy + height;
+
+ /* Don't create a source region if we are doing a fast clip */
+ if (fastClip) {
+ fastExpose = 1;
+ /*
+ * clip the source; if regions extend beyond the source size,
+ * make sure exposure events get sent
+ */
+ if (fastBox.x1 < pSrcDrawable->x) {
+ fastBox.x1 = pSrcDrawable->x;
+ fastExpose = 0;
+ }
+ if (fastBox.y1 < pSrcDrawable->y) {
+ fastBox.y1 = pSrcDrawable->y;
+ fastExpose = 0;
+ }
+ if (fastBox.x2 > pSrcDrawable->x + (int) pSrcDrawable->width) {
+ fastBox.x2 = pSrcDrawable->x + (int) pSrcDrawable->width;
+ fastExpose = 0;
+ }
+ if (fastBox.y2 > pSrcDrawable->y + (int) pSrcDrawable->height) {
+ fastBox.y2 = pSrcDrawable->y + (int) pSrcDrawable->height;
+ fastExpose = 0;
+ }
+ } else {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst, prgnSrcClip);
+ }
+
+ dstx += pDstDrawable->x;
+ dsty += pDstDrawable->y;
+
+ if (pDstDrawable->type == DRAWABLE_WINDOW) {
+ if (!((WindowPtr)pDstDrawable)->realized) {
+ if (!fastClip)
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ }
+
+ dx = srcx - dstx;
+ dy = srcy - dsty;
+
+ /* Translate and clip the dst to the destination composite clip */
+ if (fastClip) {
+ RegionPtr cclip;
+
+ /* Translate the region directly */
+ fastBox.x1 -= dx;
+ fastBox.x2 -= dx;
+ fastBox.y1 -= dy;
+ fastBox.y2 -= dy;
+
+ /* If the destination composite clip is one rectangle we can
+ do the clip directly. Otherwise we have to create a full
+ blown region and call intersect */
+
+ cclip = pGC->pCompositeClip;
+ if (REGION_NUM_RECTS(cclip) == 1) {
+ BoxPtr pBox = REGION_RECTS(cclip);
+
+ if (fastBox.x1 < pBox->x1) fastBox.x1 = pBox->x1;
+ if (fastBox.x2 > pBox->x2) fastBox.x2 = pBox->x2;
+ if (fastBox.y1 < pBox->y1) fastBox.y1 = pBox->y1;
+ if (fastBox.y2 > pBox->y2) fastBox.y2 = pBox->y2;
+
+ /* Check to see if the region is empty */
+ if (fastBox.x1 >= fastBox.x2 || fastBox.y1 >= fastBox.y2) {
+ REGION_NULL(pGC->pScreen, &rgnDst);
+ } else {
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox, 1);
+ }
+ } else {
+ /* We must turn off fastClip now, since we must create
+ a full blown region. It is intersected with the
+ composite clip below. */
+ fastClip = 0;
+ REGION_INIT(pGC->pScreen, &rgnDst, &fastBox,1);
+ }
+ } else {
+ REGION_TRANSLATE(pGC->pScreen, &rgnDst, -dx, -dy);
+ }
+
+ if (!fastClip) {
+ REGION_INTERSECT(pGC->pScreen, &rgnDst, &rgnDst,
+ pGC->pCompositeClip);
+ }
+
+ /* Do bit blitting */
+ numRects = REGION_NUM_RECTS(&rgnDst);
+ if (numRects && width && height) {
+ if(!(pptSrc = (DDXPointPtr)malloc(numRects *
+ sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return NULL;
+ }
+ pbox = REGION_RECTS(&rgnDst);
+ ppt = pptSrc;
+ for (i = numRects; --i >= 0; pbox++, ppt++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ (*doBitBlt) (pSrcDrawable, pDstDrawable, pGC, &rgnDst, pptSrc);
+ free(pptSrc);
+ }
+
+ prgnExposed = NULL;
+ if (pGC->fExpose) {
+ /* Pixmap sources generate a NoExposed (we return NULL to do this) */
+ if (!fastExpose)
+ prgnExposed = miHandleExposures(pSrcDrawable, pDstDrawable, pGC,
+ origSource.x, origSource.y,
+ (int)origSource.width,
+ (int)origSource.height,
+ origDest.x, origDest.y, bitPlane);
+ }
+ REGION_UNINIT(pGC->pScreen, &rgnDst);
+ if (freeSrcClip)
+ REGION_DESTROY(pGC->pScreen, prgnSrcClip);
+ return prgnExposed;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyArea.c b/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
index 6a898cd5f..eefd8d38d 100644
--- a/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyArea.c
@@ -1,387 +1,387 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "migc.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-
-/*
- Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
- */
-
-
-RegionPtr
-XAACopyArea(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(pDstDrawable->type == DRAWABLE_WINDOW) {
- if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
- if(infoRec->ScreenToScreenBitBlt &&
- CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoBitBlt, 0L));
- } else {
- if(infoRec->WritePixmap &&
- ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) ||
- ((pDstDrawable->bitsPerPixel == 24) &&
- (pSrcDrawable->bitsPerPixel == 32) &&
- (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
- CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
- CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags))
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoImageWrite, 0L));
- }
- } else if(IS_OFFSCREEN_PIXMAP(pDstDrawable)){
- if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
- IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
- if(infoRec->ScreenToScreenBitBlt &&
- CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
- return (XAABitBlt( pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty,
- XAADoBitBlt, 0L));
- }
- }
-
- return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
- srcx, srcy, width, height, dstx, dsty));
-}
-
-
-void
-XAADoBitBlt(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc )
-{
- int nbox, careful;
- BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
- DDXPointPtr pptTmp, pptNew1, pptNew2;
- int xdir, ydir;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- /* XXX we have to err on the side of safety when both are windows,
- * because we don't know if IncludeInferiors is being used.
- */
- careful = ((pSrc == pDst) ||
- ((pSrc->type == DRAWABLE_WINDOW) &&
- (pDst->type == DRAWABLE_WINDOW)));
-
- pbox = REGION_RECTS(prgnDst);
- nbox = REGION_NUM_RECTS(prgnDst);
-
- pboxNew1 = NULL;
- pptNew1 = NULL;
- pboxNew2 = NULL;
- pptNew2 = NULL;
- if (careful && (pptSrc->y < pbox->y1)) {
- /* walk source botttom to top */
- ydir = -1;
-
- if (nbox > 1) {
- /* keep ordering in each band, reverse order of bands */
- pboxNew1 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- if(!pboxNew1)
- return;
- pptNew1 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pptNew1) {
- xfree(pboxNew1);
- return;
- }
- pboxBase = pboxNext = pbox+nbox-1;
- while (pboxBase >= pbox) {
- while ((pboxNext >= pbox) &&
- (pboxBase->y1 == pboxNext->y1))
- pboxNext--;
- pboxTmp = pboxNext+1;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp <= pboxBase) {
- *pboxNew1++ = *pboxTmp++;
- *pptNew1++ = *pptTmp++;
- }
- pboxBase = pboxNext;
- }
- pboxNew1 -= nbox;
- pbox = pboxNew1;
- pptNew1 -= nbox;
- pptSrc = pptNew1;
- }
- } else {
- /* walk source top to bottom */
- ydir = 1;
- }
-
- if (careful && (pptSrc->x < pbox->x1)) {
- /* walk source right to left */
- xdir = -1;
-
- if (nbox > 1) {
- /* reverse order of rects in each band */
- pboxNew2 = (BoxPtr)xalloc(sizeof(BoxRec) * nbox);
- pptNew2 = (DDXPointPtr)xalloc(sizeof(DDXPointRec) * nbox);
- if(!pboxNew2 || !pptNew2) {
- if (pptNew2) xfree(pptNew2);
- if (pboxNew2) xfree(pboxNew2);
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
- return;
- }
- pboxBase = pboxNext = pbox;
- while (pboxBase < pbox+nbox) {
- while ((pboxNext < pbox+nbox) &&
- (pboxNext->y1 == pboxBase->y1))
- pboxNext++;
- pboxTmp = pboxNext;
- pptTmp = pptSrc + (pboxTmp - pbox);
- while (pboxTmp != pboxBase) {
- *pboxNew2++ = *--pboxTmp;
- *pptNew2++ = *--pptTmp;
- }
- pboxBase = pboxNext;
- }
- pboxNew2 -= nbox;
- pbox = pboxNew2;
- pptNew2 -= nbox;
- pptSrc = pptNew2;
- }
- } else {
- /* walk source left to right */
- xdir = 1;
- }
-
- (*infoRec->ScreenToScreenBitBlt)(infoRec->pScrn, nbox, pptSrc, pbox,
- xdir, ydir, pGC->alu, pGC->planemask);
-
- if (pboxNew2) {
- xfree(pptNew2);
- xfree(pboxNew2);
- }
- if (pboxNew1) {
- xfree(pptNew1);
- xfree(pboxNew1);
- }
-
-}
-
-void
-XAADoImageWrite(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc )
-{
- int srcwidth;
- unsigned char* psrcBase; /* start of image */
- unsigned char* srcPntr; /* index into the image */
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int nbox = REGION_NUM_RECTS(prgnDst);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int Bpp = pSrc->bitsPerPixel >> 3;
-
- psrcBase = (unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr;
- srcwidth = (int)((PixmapPtr)pSrc)->devKind;
-
- for(; nbox; pbox++, pptSrc++, nbox--) {
- srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp);
-
- (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, srcPntr, srcwidth,
- pGC->alu, pGC->planemask, -1, pSrc->bitsPerPixel, pSrc->depth);
- }
-}
-
-
-void
-XAADoImageRead(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc )
-{
- int dstwidth;
- unsigned char* pdstBase; /* start of image */
- unsigned char* dstPntr; /* index into the image */
- BoxPtr pbox = REGION_RECTS(prgnDst);
- int nbox = REGION_NUM_RECTS(prgnDst);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
- src and dst have same bpp */
-
- pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr;
- dstwidth = (int)((PixmapPtr)pDst)->devKind;
-
- for(; nbox; pbox++, pptSrc++, nbox--) {
- dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
-
- (*infoRec->ReadPixmap)(infoRec->pScrn, pptSrc->x, pptSrc->y,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, dstPntr, dstwidth,
- pSrc->bitsPerPixel, pSrc->depth);
- }
-}
-
-
-void
-XAAScreenToScreenBitBlt(
- ScrnInfoPtr pScrn,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir, int ydir,
- int alu,
- unsigned int planemask )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int dirsetup;
-
- if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS)
- || (xdir == ydir)) &&
- (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT)
- || (xdir == 1))) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- xdir, ydir, alu, planemask, -1);
- for (; nbox; pbox++, pptSrc++, nbox--)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
- pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- SET_SYNC_FLAG(infoRec);
- return;
- }
-
- if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) {
- /*
- * This is the case of a chip that only supports xdir = 1,
- * with ydir = 1 or ydir = -1, but we have xdir = -1.
- */
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- 1, ydir, alu, planemask, -1);
- for (; nbox; pbox++, pptSrc++, nbox--)
- if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
- /* No problem. Do a xdir = 1 blit instead. */
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x, pptSrc->y, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- else
- {
- /*
- * This is the difficult case. Needs striping into
- * non-overlapping horizontal chunks.
- */
- int stripeWidth, w, fullStripes, extra, i;
- stripeWidth = 16;
- w = pbox->x2 - pbox->x1;
- if (pbox->x1 - pptSrc->x < stripeWidth)
- stripeWidth = pbox->x1 - pptSrc->x;
- fullStripes = w / stripeWidth;
- extra = w % stripeWidth;
-
- /* First, take care of the little bit on the far right */
- if (extra)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x + fullStripes * stripeWidth, pptSrc->y,
- pbox->x1 + fullStripes * stripeWidth, pbox->y1,
- extra, pbox->y2 - pbox->y1);
-
- /* Now, take care of the rest of the blit */
- for (i = fullStripes - 1; i >= 0; i--)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x + i * stripeWidth, pptSrc->y,
- pbox->x1 + i * stripeWidth, pbox->y1,
- stripeWidth, pbox->y2 - pbox->y1);
- }
- SET_SYNC_FLAG(infoRec);
- return;
- }
-
- /*
- * Now the case of a chip that only supports xdir = ydir = 1 or
- * xdir = ydir = -1, but we have xdir != ydir.
- */
- dirsetup = 0; /* No direction set up yet. */
- for (; nbox; pbox++, pptSrc++, nbox--) {
- if (xdir == 1 && pptSrc->y != pbox->y1) {
- /* Do a xdir = ydir = -1 blit instead. */
- if (dirsetup != -1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- -1, -1, alu, planemask, -1);
- dirsetup = -1;
- }
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
- pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- }
- else if (xdir == -1 && pptSrc->y != pbox->y1) {
- /* Do a xdir = ydir = 1 blit instead. */
- if (dirsetup != 1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- 1, 1, alu, planemask, -1);
- dirsetup = 1;
- }
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
- pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- }
- else
- if (xdir == 1) {
- /*
- * xdir = 1, ydir = -1.
- * Perform line-by-line xdir = ydir = 1 blits, going up.
- */
- int i;
- if (dirsetup != 1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- 1, 1, alu, planemask, -1);
- dirsetup = 1;
- }
- for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
- pbox->x2 - pbox->x1, 1);
- }
- else {
- /*
- * xdir = -1, ydir = 1.
- * Perform line-by-line xdir = ydir = -1 blits, going down.
- */
- int i;
- if (dirsetup != -1) {
- (*infoRec->SetupForScreenToScreenCopy)(pScrn,
- -1, -1, alu, planemask, -1);
- dirsetup = -1;
- }
- for (i = 0; i < pbox->y2 - pbox->y1; i++)
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
- pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
- pbox->x2 - pbox->x1, 1);
- }
- } /* next box */
- SET_SYNC_FLAG(infoRec);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "migc.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+/*
+ Written mostly by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+ */
+
+
+RegionPtr
+XAACopyArea(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(pDstDrawable->type == DRAWABLE_WINDOW) {
+ if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
+ if(infoRec->ScreenToScreenBitBlt &&
+ CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
+ return (XAABitBlt( pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoBitBlt, 0L));
+ } else {
+ if(infoRec->WritePixmap &&
+ ((pDstDrawable->bitsPerPixel == pSrcDrawable->bitsPerPixel) ||
+ ((pDstDrawable->bitsPerPixel == 24) &&
+ (pSrcDrawable->bitsPerPixel == 32) &&
+ (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
+ CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags))
+ return (XAABitBlt( pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoImageWrite, 0L));
+ }
+ } else if(IS_OFFSCREEN_PIXMAP(pDstDrawable)){
+ if((pSrcDrawable->type == DRAWABLE_WINDOW) ||
+ IS_OFFSCREEN_PIXMAP(pSrcDrawable)){
+ if(infoRec->ScreenToScreenBitBlt &&
+ CHECK_ROP(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->ScreenToScreenBitBltFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->ScreenToScreenBitBltFlags))
+ return (XAABitBlt( pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height, dstx, dsty,
+ XAADoBitBlt, 0L));
+ }
+ }
+
+ return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC,
+ srcx, srcy, width, height, dstx, dsty));
+}
+
+
+void
+XAADoBitBlt(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc )
+{
+ int nbox, careful;
+ BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
+ DDXPointPtr pptTmp, pptNew1, pptNew2;
+ int xdir, ydir;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ /* XXX we have to err on the side of safety when both are windows,
+ * because we don't know if IncludeInferiors is being used.
+ */
+ careful = ((pSrc == pDst) ||
+ ((pSrc->type == DRAWABLE_WINDOW) &&
+ (pDst->type == DRAWABLE_WINDOW)));
+
+ pbox = REGION_RECTS(prgnDst);
+ nbox = REGION_NUM_RECTS(prgnDst);
+
+ pboxNew1 = NULL;
+ pptNew1 = NULL;
+ pboxNew2 = NULL;
+ pptNew2 = NULL;
+ if (careful && (pptSrc->y < pbox->y1)) {
+ /* walk source botttom to top */
+ ydir = -1;
+
+ if (nbox > 1) {
+ /* keep ordering in each band, reverse order of bands */
+ pboxNew1 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
+ if(!pboxNew1)
+ return;
+ pptNew1 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
+ if(!pptNew1) {
+ free(pboxNew1);
+ return;
+ }
+ pboxBase = pboxNext = pbox+nbox-1;
+ while (pboxBase >= pbox) {
+ while ((pboxNext >= pbox) &&
+ (pboxBase->y1 == pboxNext->y1))
+ pboxNext--;
+ pboxTmp = pboxNext+1;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp <= pboxBase) {
+ *pboxNew1++ = *pboxTmp++;
+ *pptNew1++ = *pptTmp++;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew1 -= nbox;
+ pbox = pboxNew1;
+ pptNew1 -= nbox;
+ pptSrc = pptNew1;
+ }
+ } else {
+ /* walk source top to bottom */
+ ydir = 1;
+ }
+
+ if (careful && (pptSrc->x < pbox->x1)) {
+ /* walk source right to left */
+ xdir = -1;
+
+ if (nbox > 1) {
+ /* reverse order of rects in each band */
+ pboxNew2 = (BoxPtr)malloc(sizeof(BoxRec) * nbox);
+ pptNew2 = (DDXPointPtr)malloc(sizeof(DDXPointRec) * nbox);
+ if(!pboxNew2 || !pptNew2) {
+ if (pptNew2) free(pptNew2);
+ if (pboxNew2) free(pboxNew2);
+ if (pboxNew1) {
+ free(pptNew1);
+ free(pboxNew1);
+ }
+ return;
+ }
+ pboxBase = pboxNext = pbox;
+ while (pboxBase < pbox+nbox) {
+ while ((pboxNext < pbox+nbox) &&
+ (pboxNext->y1 == pboxBase->y1))
+ pboxNext++;
+ pboxTmp = pboxNext;
+ pptTmp = pptSrc + (pboxTmp - pbox);
+ while (pboxTmp != pboxBase) {
+ *pboxNew2++ = *--pboxTmp;
+ *pptNew2++ = *--pptTmp;
+ }
+ pboxBase = pboxNext;
+ }
+ pboxNew2 -= nbox;
+ pbox = pboxNew2;
+ pptNew2 -= nbox;
+ pptSrc = pptNew2;
+ }
+ } else {
+ /* walk source left to right */
+ xdir = 1;
+ }
+
+ (*infoRec->ScreenToScreenBitBlt)(infoRec->pScrn, nbox, pptSrc, pbox,
+ xdir, ydir, pGC->alu, pGC->planemask);
+
+ if (pboxNew2) {
+ free(pptNew2);
+ free(pboxNew2);
+ }
+ if (pboxNew1) {
+ free(pptNew1);
+ free(pboxNew1);
+ }
+
+}
+
+void
+XAADoImageWrite(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc )
+{
+ int srcwidth;
+ unsigned char* psrcBase; /* start of image */
+ unsigned char* srcPntr; /* index into the image */
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int nbox = REGION_NUM_RECTS(prgnDst);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Bpp = pSrc->bitsPerPixel >> 3;
+
+ psrcBase = (unsigned char *)((PixmapPtr)pSrc)->devPrivate.ptr;
+ srcwidth = (int)((PixmapPtr)pSrc)->devKind;
+
+ for(; nbox; pbox++, pptSrc++, nbox--) {
+ srcPntr = psrcBase + (pptSrc->y * srcwidth) + (pptSrc->x * Bpp);
+
+ (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, srcPntr, srcwidth,
+ pGC->alu, pGC->planemask, -1, pSrc->bitsPerPixel, pSrc->depth);
+ }
+}
+
+
+void
+XAADoImageRead(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc )
+{
+ int dstwidth;
+ unsigned char* pdstBase; /* start of image */
+ unsigned char* dstPntr; /* index into the image */
+ BoxPtr pbox = REGION_RECTS(prgnDst);
+ int nbox = REGION_NUM_RECTS(prgnDst);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both
+ src and dst have same bpp */
+
+ pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr;
+ dstwidth = (int)((PixmapPtr)pDst)->devKind;
+
+ for(; nbox; pbox++, pptSrc++, nbox--) {
+ dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp);
+
+ (*infoRec->ReadPixmap)(infoRec->pScrn, pptSrc->x, pptSrc->y,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, dstPntr, dstwidth,
+ pSrc->bitsPerPixel, pSrc->depth);
+ }
+}
+
+
+void
+XAAScreenToScreenBitBlt(
+ ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir, int ydir,
+ int alu,
+ unsigned int planemask )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int dirsetup;
+
+ if ((!(infoRec->CopyAreaFlags & ONLY_TWO_BITBLT_DIRECTIONS)
+ || (xdir == ydir)) &&
+ (!(infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT)
+ || (xdir == 1))) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ xdir, ydir, alu, planemask, -1);
+ for (; nbox; pbox++, pptSrc++, nbox--)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ SET_SYNC_FLAG(infoRec);
+ return;
+ }
+
+ if (infoRec->CopyAreaFlags & ONLY_LEFT_TO_RIGHT_BITBLT) {
+ /*
+ * This is the case of a chip that only supports xdir = 1,
+ * with ydir = 1 or ydir = -1, but we have xdir = -1.
+ */
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ 1, ydir, alu, planemask, -1);
+ for (; nbox; pbox++, pptSrc++, nbox--)
+ if (pptSrc->y != pbox->y1 || pptSrc->x >= pbox->x1)
+ /* No problem. Do a xdir = 1 blit instead. */
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x, pptSrc->y, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ else
+ {
+ /*
+ * This is the difficult case. Needs striping into
+ * non-overlapping horizontal chunks.
+ */
+ int stripeWidth, w, fullStripes, extra, i;
+ stripeWidth = 16;
+ w = pbox->x2 - pbox->x1;
+ if (pbox->x1 - pptSrc->x < stripeWidth)
+ stripeWidth = pbox->x1 - pptSrc->x;
+ fullStripes = w / stripeWidth;
+ extra = w % stripeWidth;
+
+ /* First, take care of the little bit on the far right */
+ if (extra)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x + fullStripes * stripeWidth, pptSrc->y,
+ pbox->x1 + fullStripes * stripeWidth, pbox->y1,
+ extra, pbox->y2 - pbox->y1);
+
+ /* Now, take care of the rest of the blit */
+ for (i = fullStripes - 1; i >= 0; i--)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x + i * stripeWidth, pptSrc->y,
+ pbox->x1 + i * stripeWidth, pbox->y1,
+ stripeWidth, pbox->y2 - pbox->y1);
+ }
+ SET_SYNC_FLAG(infoRec);
+ return;
+ }
+
+ /*
+ * Now the case of a chip that only supports xdir = ydir = 1 or
+ * xdir = ydir = -1, but we have xdir != ydir.
+ */
+ dirsetup = 0; /* No direction set up yet. */
+ for (; nbox; pbox++, pptSrc++, nbox--) {
+ if (xdir == 1 && pptSrc->y != pbox->y1) {
+ /* Do a xdir = ydir = -1 blit instead. */
+ if (dirsetup != -1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ -1, -1, alu, planemask, -1);
+ dirsetup = -1;
+ }
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ }
+ else if (xdir == -1 && pptSrc->y != pbox->y1) {
+ /* Do a xdir = ydir = 1 blit instead. */
+ if (dirsetup != 1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ 1, 1, alu, planemask, -1);
+ dirsetup = 1;
+ }
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,pptSrc->x, pptSrc->y,
+ pbox->x1, pbox->y1, pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ }
+ else
+ if (xdir == 1) {
+ /*
+ * xdir = 1, ydir = -1.
+ * Perform line-by-line xdir = ydir = 1 blits, going up.
+ */
+ int i;
+ if (dirsetup != 1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ 1, 1, alu, planemask, -1);
+ dirsetup = 1;
+ }
+ for (i = pbox->y2 - pbox->y1 - 1; i >= 0; i--)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
+ pbox->x2 - pbox->x1, 1);
+ }
+ else {
+ /*
+ * xdir = -1, ydir = 1.
+ * Perform line-by-line xdir = ydir = -1 blits, going down.
+ */
+ int i;
+ if (dirsetup != -1) {
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn,
+ -1, -1, alu, planemask, -1);
+ dirsetup = -1;
+ }
+ for (i = 0; i < pbox->y2 - pbox->y1; i++)
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn,
+ pptSrc->x, pptSrc->y + i, pbox->x1, pbox->y1 + i,
+ pbox->x2 - pbox->x1, 1);
+ }
+ } /* next box */
+ SET_SYNC_FLAG(infoRec);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c b/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
index aa4c0407c..358cb6fb2 100644
--- a/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyPlane.c
@@ -1,208 +1,208 @@
-
-/*
- A CopyPlane function that handles bitmap->screen copies and
- sends anything else to the Fallback.
-
- Also, a PushPixels for solid fill styles.
-
- Written by Mark Vojkovich (markv@valinux.com)
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "servermd.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-
-static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
- GCPtr pGC, RegionPtr rgnDst,
- DDXPointPtr pptSrc);
-static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
- GCPtr pGC, RegionPtr rgnDst,
- DDXPointPtr pptSrc);
-
-
-static unsigned long TmpBitPlane;
-
-RegionPtr
-XAACopyPlaneColorExpansion(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- if((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) {
- if(pSrc->bitsPerPixel == 1) {
- return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty,
- XAACopyPlane1toNColorExpand, bitPlane));
- } else if(bitPlane < (1 << pDst->depth)){
- TmpBitPlane = bitPlane;
- return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty,
- XAACopyPlaneNtoNColorExpand, bitPlane));
- }
- }
-
- return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy,
- width, height, dstx, dsty, bitPlane));
-}
-
-
-static void
-XAACopyPlane1toNColorExpand(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- RegionPtr rgnDst,
- DDXPointPtr pptSrc )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- BoxPtr pbox = REGION_RECTS(rgnDst);
- int numrects = REGION_NUM_RECTS(rgnDst);
- unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
- int srcwidth = ((PixmapPtr)pSrc)->devKind;
-
- while(numrects--) {
- (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- src + (srcwidth * pptSrc->y) + ((pptSrc->x >> 5) << 2),
- srcwidth, pptSrc->x & 31,
- pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
- pbox++; pptSrc++;
- }
-}
-
-
-static void
-XAACopyPlaneNtoNColorExpand(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- RegionPtr rgnDst,
- DDXPointPtr pptSrc
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- BoxPtr pbox = REGION_RECTS(rgnDst);
- int numrects = REGION_NUM_RECTS(rgnDst);
- unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
- unsigned char *data, *srcPtr, *dataPtr;
- int srcwidth = ((PixmapPtr)pSrc)->devKind;
- int pitch, width, height, h, i, index, offset;
- int Bpp = pSrc->bitsPerPixel >> 3;
- unsigned long mask = TmpBitPlane;
-
- if(TmpBitPlane < (1 << 8)) {
- offset = 0;
- } else if(TmpBitPlane < (1 << 16)) {
- offset = 1;
- mask >>= 8;
- } else if(TmpBitPlane < (1 << 24)) {
- offset = 2;
- mask >>= 16;
- } else {
- offset = 3;
- mask >>= 24;
- }
-
- if(IS_OFFSCREEN_PIXMAP(pSrc))
- SYNC_CHECK(pSrc);
-
- while(numrects--) {
- width = pbox->x2 - pbox->x1;
- h = height = pbox->y2 - pbox->y1;
- pitch = BitmapBytePad(width);
-
- if(!(data = xcalloc(height, pitch)))
- goto ALLOC_FAILED;
-
- dataPtr = data;
- srcPtr = ((pptSrc->y) * srcwidth) + src +
- ((pptSrc->x) * Bpp) + offset;
-
- while(h--) {
- for(i = index = 0; i < width; i++, index += Bpp) {
- if(mask & srcPtr[index])
- dataPtr[i >> 3] |= (1 << (i & 7));
- }
- dataPtr += pitch;
- srcPtr += srcwidth;
- }
-
- (*infoRec->WriteBitmap)(infoRec->pScrn,
- pbox->x1, pbox->y1, width, height, data, pitch, 0,
- pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
-
- xfree(data);
-
-ALLOC_FAILED:
-
- pbox++; pptSrc++;
- }
-}
-
-void
-XAAPushPixelsSolidColorExpansion(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy,
- int xOrg, int yOrg )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int MaxBoxes = REGION_NUM_RECTS(pGC->pCompositeClip);
- BoxPtr pbox, pClipBoxes;
- int nboxes, srcx, srcy;
- xRectangle TheRect;
- unsigned char *src = pBitMap->devPrivate.ptr;
- int srcwidth = pBitMap->devKind;
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- TheRect.x = xOrg;
- TheRect.y = yOrg;
- TheRect.width = dx;
- TheRect.height = dy;
-
- if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
- pClipBoxes = xalloc(MaxBoxes * sizeof(BoxRec));
- if(!pClipBoxes) return;
- } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
-
- nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
- pbox = pClipBoxes;
-
- while(nboxes--) {
- srcx = pbox->x1 - xOrg;
- srcy = pbox->y1 - yOrg;
- (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- src + (srcwidth * srcy) + ((srcx >> 5) << 2),
- srcwidth, srcx & 31,
- pGC->fgPixel, -1, pGC->alu, pGC->planemask);
- pbox++;
- }
-
- if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
- xfree(pClipBoxes);
-}
-
+
+/*
+ A CopyPlane function that handles bitmap->screen copies and
+ sends anything else to the Fallback.
+
+ Also, a PushPixels for solid fill styles.
+
+ Written by Mark Vojkovich (markv@valinux.com)
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "servermd.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+
+static void XAACopyPlane1toNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst,
+ DDXPointPtr pptSrc);
+static void XAACopyPlaneNtoNColorExpand(DrawablePtr pSrc, DrawablePtr pDst,
+ GCPtr pGC, RegionPtr rgnDst,
+ DDXPointPtr pptSrc);
+
+
+static unsigned long TmpBitPlane;
+
+RegionPtr
+XAACopyPlaneColorExpansion(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ if((pSrc->type == DRAWABLE_PIXMAP) && !XAA_DEPTH_BUG(pGC)) {
+ if(pSrc->bitsPerPixel == 1) {
+ return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty,
+ XAACopyPlane1toNColorExpand, bitPlane));
+ } else if(bitPlane < (1 << pDst->depth)){
+ TmpBitPlane = bitPlane;
+ return(XAABitBlt(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty,
+ XAACopyPlaneNtoNColorExpand, bitPlane));
+ }
+ }
+
+ return (XAAFallbackOps.CopyPlane(pSrc, pDst, pGC, srcx, srcy,
+ width, height, dstx, dsty, bitPlane));
+}
+
+
+static void
+XAACopyPlane1toNColorExpand(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ RegionPtr rgnDst,
+ DDXPointPtr pptSrc )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pbox = REGION_RECTS(rgnDst);
+ int numrects = REGION_NUM_RECTS(rgnDst);
+ unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
+ int srcwidth = ((PixmapPtr)pSrc)->devKind;
+
+ while(numrects--) {
+ (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ src + (srcwidth * pptSrc->y) + ((pptSrc->x >> 5) << 2),
+ srcwidth, pptSrc->x & 31,
+ pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
+ pbox++; pptSrc++;
+ }
+}
+
+
+static void
+XAACopyPlaneNtoNColorExpand(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ RegionPtr rgnDst,
+ DDXPointPtr pptSrc
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ BoxPtr pbox = REGION_RECTS(rgnDst);
+ int numrects = REGION_NUM_RECTS(rgnDst);
+ unsigned char *src = ((PixmapPtr)pSrc)->devPrivate.ptr;
+ unsigned char *data, *srcPtr, *dataPtr;
+ int srcwidth = ((PixmapPtr)pSrc)->devKind;
+ int pitch, width, height, h, i, index, offset;
+ int Bpp = pSrc->bitsPerPixel >> 3;
+ unsigned long mask = TmpBitPlane;
+
+ if(TmpBitPlane < (1 << 8)) {
+ offset = 0;
+ } else if(TmpBitPlane < (1 << 16)) {
+ offset = 1;
+ mask >>= 8;
+ } else if(TmpBitPlane < (1 << 24)) {
+ offset = 2;
+ mask >>= 16;
+ } else {
+ offset = 3;
+ mask >>= 24;
+ }
+
+ if(IS_OFFSCREEN_PIXMAP(pSrc))
+ SYNC_CHECK(pSrc);
+
+ while(numrects--) {
+ width = pbox->x2 - pbox->x1;
+ h = height = pbox->y2 - pbox->y1;
+ pitch = BitmapBytePad(width);
+
+ if(!(data = calloc(height, pitch)))
+ goto ALLOC_FAILED;
+
+ dataPtr = data;
+ srcPtr = ((pptSrc->y) * srcwidth) + src +
+ ((pptSrc->x) * Bpp) + offset;
+
+ while(h--) {
+ for(i = index = 0; i < width; i++, index += Bpp) {
+ if(mask & srcPtr[index])
+ dataPtr[i >> 3] |= (1 << (i & 7));
+ }
+ dataPtr += pitch;
+ srcPtr += srcwidth;
+ }
+
+ (*infoRec->WriteBitmap)(infoRec->pScrn,
+ pbox->x1, pbox->y1, width, height, data, pitch, 0,
+ pGC->fgPixel, pGC->bgPixel, pGC->alu, pGC->planemask);
+
+ free(data);
+
+ALLOC_FAILED:
+
+ pbox++; pptSrc++;
+ }
+}
+
+void
+XAAPushPixelsSolidColorExpansion(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy,
+ int xOrg, int yOrg )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int MaxBoxes = REGION_NUM_RECTS(pGC->pCompositeClip);
+ BoxPtr pbox, pClipBoxes;
+ int nboxes, srcx, srcy;
+ xRectangle TheRect;
+ unsigned char *src = pBitMap->devPrivate.ptr;
+ int srcwidth = pBitMap->devKind;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ TheRect.x = xOrg;
+ TheRect.y = yOrg;
+ TheRect.width = dx;
+ TheRect.height = dy;
+
+ if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
+ pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
+ if(!pClipBoxes) return;
+ } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
+
+ nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
+ pbox = pClipBoxes;
+
+ while(nboxes--) {
+ srcx = pbox->x1 - xOrg;
+ srcy = pbox->y1 - yOrg;
+ (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ src + (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31,
+ pGC->fgPixel, -1, pGC->alu, pGC->planemask);
+ pbox++;
+ }
+
+ if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
+ free(pClipBoxes);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaCpyWin.c b/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
index 31c421e65..34f460f24 100644
--- a/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
+++ b/xorg-server/hw/xfree86/xaa/xaaCpyWin.c
@@ -1,82 +1,82 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "xaawrap.h"
-
-/*
- Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
-*/
-
-void
-XAACopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc )
-{
- DDXPointPtr pptSrc, ppt;
- RegionRec rgnDst;
- BoxPtr pbox;
- int dx, dy, nbox;
- WindowPtr pwinRoot;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec =
- GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
-
- if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
- return;
- }
-
- pwinRoot = WindowTable[pScreen->myNum];
-
- REGION_NULL(pScreen, &rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
- REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-
- pbox = REGION_RECTS(&rgnDst);
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
- REGION_UNINIT(pScreen, &rgnDst);
- return;
- }
- ppt = pptSrc;
-
- while(nbox--) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- ppt++; pbox++;
- }
-
- infoRec->ScratchGC.planemask = ~0L;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- xfree(pptSrc);
- REGION_UNINIT(pScreen, &rgnDst);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+/*
+ Written by Harm Hanemaayer (H.Hanemaayer@inter.nl.net).
+*/
+
+void
+XAACopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc )
+{
+ DDXPointPtr pptSrc, ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy, nbox;
+ WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow);
+ return;
+ }
+
+ pwinRoot = WindowTable[pScreen->myNum];
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(!nbox ||
+ !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ while(nbox--) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ ppt++; pbox++;
+ }
+
+ infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ free(pptSrc);
+ REGION_UNINIT(pScreen, &rgnDst);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaGC.c b/xorg-server/hw/xfree86/xaa/xaaGC.c
index e6083d529..d029d982b 100644
--- a/xorg-server/hw/xfree86/xaa/xaaGC.c
+++ b/xorg-server/hw/xfree86/xaa/xaaGC.c
@@ -1,656 +1,656 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "migc.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "xaawrap.h"
-
-static void XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
-static void XAAChangeGC(GCPtr pGC, unsigned long mask);
-static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void XAADestroyGC(GCPtr pGC);
-static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
-static void XAADestroyClip(GCPtr pGC);
-static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-
-GCFuncs XAAGCFuncs = {
- XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
- XAAChangeClip, XAADestroyClip, XAACopyClip
-};
-
-extern GCOps XAAPixmapOps;
-
-Bool
-XAACreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
- XAAGetGCKey());
- Bool ret;
-
- XAA_SCREEN_PROLOGUE(pScreen,CreateGC);
-
- if((ret = (*pScreen->CreateGC)(pGC))) {
- pGCPriv->wrapOps = NULL;
- pGCPriv->wrapFuncs = pGC->funcs;
- pGCPriv->XAAOps = &XAAFallbackOps;
- pGCPriv->flags = 0;
- pGCPriv->DashLength = 0;
- pGCPriv->DashPattern = NULL;
- pGCPriv->changes = 0;
- /* initialize any other private fields here */
- pGC->funcs = &XAAGCFuncs;
- }
-
- XAA_SCREEN_EPILOGUE(pScreen,CreateGC,XAACreateGC);
-
- return ret;
-}
-
-
-static void
-XAAValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAA_GC_FUNC_PROLOGUE(pGC);
-
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
-
- if((changes & GCPlaneMask) &&
- ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) ==
- infoRec->FullPlanemasks[pGC->depth - 1]))
- {
- pGC->planemask = ~0;
- }
-
- if(pGC->depth != 32) {
- /* 0xffffffff is reserved for transparency */
- if(pGC->bgPixel == 0xffffffff)
- pGC->bgPixel = 0x7fffffff;
- if(pGC->fgPixel == 0xffffffff)
- pGC->fgPixel = 0x7fffffff;
- }
-
- if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){
- pGCPriv->flags = OPS_ARE_PIXMAP;
- pGCPriv->changes |= changes;
-
- /* make sure we're not using videomemory pixmaps to render
- onto system memory drawables */
-
- if((pGC->fillStyle == FillTiled) &&
- IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
- !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {
-
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- FBAreaPtr area = pPriv->offscreenArea;
-
- XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
- xf86FreeOffscreenArea(area);
- }
- }
- else if(!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
- pGCPriv->flags = 0;
- pGCPriv->changes |= changes;
- }
- else {
- if(!(pGCPriv->flags & OPS_ARE_ACCEL)) {
- changes |= pGCPriv->changes;
- pGCPriv->changes = 0;
- }
- pGCPriv->flags = OPS_ARE_ACCEL;
-
-#if 1
- /* Ugh. If we can't use the blitter on offscreen pixmaps used
- as tiles, then we need to move them out as cfb can't handle
- tiles with non-zero origins */
-
- if((pGC->fillStyle == FillTiled) &&
- IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
- (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser)(pGC))) {
-
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- FBAreaPtr area = pPriv->offscreenArea;
-
- XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
- xf86FreeOffscreenArea(area);
- }
-#endif
- }
-
- XAA_GC_FUNC_EPILOGUE(pGC);
-
- if(!(pGCPriv->flags & OPS_ARE_ACCEL)) return;
-
- if((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap){
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
-
- if(pixPriv->flags & DIRTY) {
- pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
- pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
- }
- if((changes & GCStipple) && pGC->stipple){
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
-
- if(pixPriv->flags & DIRTY) {
- pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
- pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
- }
-
- /* If our Ops are still the default ones we need to allocate new ones */
- if(pGC->ops == &XAAFallbackOps) {
- if(!(pGCPriv->XAAOps = xalloc(sizeof(GCOps)))) {
- pGCPriv->XAAOps = &XAAFallbackOps;
- return;
- }
- /* make a modifiable copy of the default ops */
- memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
- pGC->ops = pGCPriv->XAAOps;
- changes = ~0;
- }
-
- if(!changes) return;
-
- if((changes & GCDashList) && infoRec->ComputeDash)
- infoRec->ComputeDash(pGC);
-
- if(changes & infoRec->FillSpansMask)
- (*infoRec->ValidateFillSpans)(pGC, changes, pDraw);
-
- if(changes & infoRec->SetSpansMask)
- (*infoRec->ValidateSetSpans)(pGC, changes, pDraw);
-
- if(changes & infoRec->PutImageMask)
- (*infoRec->ValidatePutImage)(pGC, changes, pDraw);
-
- if(changes & infoRec->CopyAreaMask)
- (*infoRec->ValidateCopyArea)(pGC, changes, pDraw);
-
- if(changes & infoRec->CopyPlaneMask)
- (*infoRec->ValidateCopyPlane)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyPointMask)
- (*infoRec->ValidatePolyPoint)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolylinesMask)
- (*infoRec->ValidatePolylines)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolySegmentMask)
- (*infoRec->ValidatePolySegment)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyRectangleMask)
- (*infoRec->ValidatePolyRectangle)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyArcMask)
- (*infoRec->ValidatePolyArc)(pGC, changes, pDraw);
-
- if(changes & infoRec->FillPolygonMask)
- (*infoRec->ValidateFillPolygon)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyFillRectMask)
- (*infoRec->ValidatePolyFillRect)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyFillArcMask)
- (*infoRec->ValidatePolyFillArc)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyGlyphBltMask)
- (*infoRec->ValidatePolyGlyphBlt)(pGC, changes, pDraw);
-
- if(changes & infoRec->ImageGlyphBltMask)
- (*infoRec->ValidateImageGlyphBlt)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyText8Mask)
- (*infoRec->ValidatePolyText8)(pGC, changes, pDraw);
-
- if(changes & infoRec->PolyText16Mask)
- (*infoRec->ValidatePolyText16)(pGC, changes, pDraw);
-
- if(changes & infoRec->ImageText8Mask)
- (*infoRec->ValidateImageText8)(pGC, changes, pDraw);
-
- if(changes & infoRec->ImageText16Mask)
- (*infoRec->ValidateImageText16)(pGC, changes, pDraw);
-
- if(changes & infoRec->PushPixelsMask)
- (*infoRec->ValidatePushPixels)(pGC, changes, pDraw);
-}
-
-
-static void
-XAADestroyGC(GCPtr pGC)
-{
- XAA_GC_FUNC_PROLOGUE (pGC);
-
- if(pGCPriv->XAAOps != &XAAFallbackOps)
- xfree(pGCPriv->XAAOps);
-
- if(pGCPriv->DashPattern)
- xfree(pGCPriv->DashPattern);
-
- (*pGC->funcs->DestroyGC)(pGC);
- XAA_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XAAChangeGC (
- GCPtr pGC,
- unsigned long mask
-)
-{
- XAA_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- XAA_GC_FUNC_EPILOGUE (pGC);
-
- /* we have to assume that shared memory pixmaps are dirty
- because we can't wrap all operations on them */
-
- if((mask & GCTile) && !pGC->tileIsPixel &&
- PIXMAP_IS_SHARED(pGC->tile.pixmap))
- {
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
- pPixPriv->flags |= DIRTY;
- }
-
- if((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)){
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
- pPixPriv->flags |= DIRTY;
- }
-}
-
-static void
-XAACopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst)
-{
- XAA_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- XAA_GC_FUNC_EPILOGUE (pGCDst);
-}
-static void
-XAAChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects )
-{
- XAA_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- XAA_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- XAA_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- XAA_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-XAADestroyClip(GCPtr pGC)
-{
- XAA_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- XAA_GC_FUNC_EPILOGUE (pGC);
-}
-
-/**** Pixmap Wrappers ****/
-
-
-
-static void
-XAAFillSpansPixmap(
- DrawablePtr pDraw,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidthInit,
- int fSorted
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAASetSpansPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- char *pcharsrc,
- register DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPutImagePixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x, int y, int w, int h,
- int leftPad,
- int format,
- char *pImage
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static RegionPtr
-XAACopyAreaPixmap(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- RegionPtr ret;
-
- if(infoRec->pScrn->vtSema &&
- ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc)))
- {
- if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
- (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
- ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
- == infoRec->FullPlanemasks[pSrc->depth - 1]))
- {
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst));
- pixPriv->flags |= DIRTY;
-
- return (XAABitBlt( pSrc, pDst, pGC,
- srcx, srcy, width, height, dstx, dsty,
- XAADoImageRead, 0L));
- } else
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- }
-
- {
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
- ret = (*pGC->ops->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
- }
- return ret;
-}
-
-static RegionPtr
-XAACopyPlanePixmap(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- RegionPtr ret;
-
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
-
- if(infoRec->pScrn->vtSema &&
- ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- }
-
- ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-XAAPolyPointPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- xPoint *pptInit
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAPolylinesPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolySegmentPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolyRectanglePixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolyArcPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAFillPolygonPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAPolyFillRectPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAPolyFillArcPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static int
-XAAPolyText8Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- int ret;
-
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static int
-XAAPolyText16Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- int ret;
-
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
- return ret;
-}
-
-static void
-XAAImageText8Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-static void
-XAAImageText16Pixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-
-static void
-XAAImageGlyphBltPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPolyGlyphBltPixmap(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
- ppci, pglyphBase);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-static void
-XAAPushPixelsPixmap(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy, int xOrg, int yOrg
-){
- XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
- (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
- XAA_PIXMAP_OP_EPILOGUE(pGC);
-}
-
-GCOps XAAPixmapOps = {
- XAAFillSpansPixmap, XAASetSpansPixmap,
- XAAPutImagePixmap, XAACopyAreaPixmap,
- XAACopyPlanePixmap, XAAPolyPointPixmap,
- XAAPolylinesPixmap, XAAPolySegmentPixmap,
- XAAPolyRectanglePixmap, XAAPolyArcPixmap,
- XAAFillPolygonPixmap, XAAPolyFillRectPixmap,
- XAAPolyFillArcPixmap, XAAPolyText8Pixmap,
- XAAPolyText16Pixmap, XAAImageText8Pixmap,
- XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
- XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap,
- {NULL} /* devPrivate */
-};
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "migc.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "xaawrap.h"
+
+static void XAAValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
+static void XAAChangeGC(GCPtr pGC, unsigned long mask);
+static void XAACopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void XAADestroyGC(GCPtr pGC);
+static void XAAChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects);
+static void XAADestroyClip(GCPtr pGC);
+static void XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+
+GCFuncs XAAGCFuncs = {
+ XAAValidateGC, XAAChangeGC, XAACopyGC, XAADestroyGC,
+ XAAChangeClip, XAADestroyClip, XAACopyClip
+};
+
+extern GCOps XAAPixmapOps;
+
+Bool
+XAACreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ Bool ret;
+
+ XAA_SCREEN_PROLOGUE(pScreen,CreateGC);
+
+ if((ret = (*pScreen->CreateGC)(pGC))) {
+ pGCPriv->wrapOps = NULL;
+ pGCPriv->wrapFuncs = pGC->funcs;
+ pGCPriv->XAAOps = &XAAFallbackOps;
+ pGCPriv->flags = 0;
+ pGCPriv->DashLength = 0;
+ pGCPriv->DashPattern = NULL;
+ pGCPriv->changes = 0;
+ /* initialize any other private fields here */
+ pGC->funcs = &XAAGCFuncs;
+ }
+
+ XAA_SCREEN_EPILOGUE(pScreen,CreateGC,XAACreateGC);
+
+ return ret;
+}
+
+
+static void
+XAAValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAA_GC_FUNC_PROLOGUE(pGC);
+
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+
+ if((changes & GCPlaneMask) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) ==
+ infoRec->FullPlanemasks[pGC->depth - 1]))
+ {
+ pGC->planemask = ~0;
+ }
+
+ if(pGC->depth != 32) {
+ /* 0xffffffff is reserved for transparency */
+ if(pGC->bgPixel == 0xffffffff)
+ pGC->bgPixel = 0x7fffffff;
+ if(pGC->fgPixel == 0xffffffff)
+ pGC->fgPixel = 0x7fffffff;
+ }
+
+ if((pDraw->type == DRAWABLE_PIXMAP) && !IS_OFFSCREEN_PIXMAP(pDraw)){
+ pGCPriv->flags = OPS_ARE_PIXMAP;
+ pGCPriv->changes |= changes;
+
+ /* make sure we're not using videomemory pixmaps to render
+ onto system memory drawables */
+
+ if((pGC->fillStyle == FillTiled) &&
+ IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
+ !OFFSCREEN_PIXMAP_LOCKED(pGC->tile.pixmap)) {
+
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ FBAreaPtr area = pPriv->offscreenArea;
+
+ XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
+ xf86FreeOffscreenArea(area);
+ }
+ }
+ else if(!infoRec->pScrn->vtSema && (pDraw->type == DRAWABLE_WINDOW)) {
+ pGCPriv->flags = 0;
+ pGCPriv->changes |= changes;
+ }
+ else {
+ if(!(pGCPriv->flags & OPS_ARE_ACCEL)) {
+ changes |= pGCPriv->changes;
+ pGCPriv->changes = 0;
+ }
+ pGCPriv->flags = OPS_ARE_ACCEL;
+
+#if 1
+ /* Ugh. If we can't use the blitter on offscreen pixmaps used
+ as tiles, then we need to move them out as cfb can't handle
+ tiles with non-zero origins */
+
+ if((pGC->fillStyle == FillTiled) &&
+ IS_OFFSCREEN_PIXMAP(pGC->tile.pixmap) &&
+ (DO_PIXMAP_COPY != (*infoRec->TiledFillChooser)(pGC))) {
+
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ FBAreaPtr area = pPriv->offscreenArea;
+
+ XAARemoveAreaCallback(area); /* clobbers pPriv->offscreenArea */
+ xf86FreeOffscreenArea(area);
+ }
+#endif
+ }
+
+ XAA_GC_FUNC_EPILOGUE(pGC);
+
+ if(!(pGCPriv->flags & OPS_ARE_ACCEL)) return;
+
+ if((changes & GCTile) && !pGC->tileIsPixel && pGC->tile.pixmap){
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+
+ if(pixPriv->flags & DIRTY) {
+ pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
+ pGC->tile.pixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ }
+ if((changes & GCStipple) && pGC->stipple){
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+
+ if(pixPriv->flags & DIRTY) {
+ pixPriv->flags &= ~(DIRTY | REDUCIBILITY_MASK);
+ pGC->stipple->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
+ }
+
+ /* If our Ops are still the default ones we need to allocate new ones */
+ if(pGC->ops == &XAAFallbackOps) {
+ if(!(pGCPriv->XAAOps = malloc(sizeof(GCOps)))) {
+ pGCPriv->XAAOps = &XAAFallbackOps;
+ return;
+ }
+ /* make a modifiable copy of the default ops */
+ memcpy(pGCPriv->XAAOps, &XAAFallbackOps, sizeof(GCOps));
+ pGC->ops = pGCPriv->XAAOps;
+ changes = ~0;
+ }
+
+ if(!changes) return;
+
+ if((changes & GCDashList) && infoRec->ComputeDash)
+ infoRec->ComputeDash(pGC);
+
+ if(changes & infoRec->FillSpansMask)
+ (*infoRec->ValidateFillSpans)(pGC, changes, pDraw);
+
+ if(changes & infoRec->SetSpansMask)
+ (*infoRec->ValidateSetSpans)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PutImageMask)
+ (*infoRec->ValidatePutImage)(pGC, changes, pDraw);
+
+ if(changes & infoRec->CopyAreaMask)
+ (*infoRec->ValidateCopyArea)(pGC, changes, pDraw);
+
+ if(changes & infoRec->CopyPlaneMask)
+ (*infoRec->ValidateCopyPlane)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyPointMask)
+ (*infoRec->ValidatePolyPoint)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolylinesMask)
+ (*infoRec->ValidatePolylines)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolySegmentMask)
+ (*infoRec->ValidatePolySegment)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyRectangleMask)
+ (*infoRec->ValidatePolyRectangle)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyArcMask)
+ (*infoRec->ValidatePolyArc)(pGC, changes, pDraw);
+
+ if(changes & infoRec->FillPolygonMask)
+ (*infoRec->ValidateFillPolygon)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyFillRectMask)
+ (*infoRec->ValidatePolyFillRect)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyFillArcMask)
+ (*infoRec->ValidatePolyFillArc)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyGlyphBltMask)
+ (*infoRec->ValidatePolyGlyphBlt)(pGC, changes, pDraw);
+
+ if(changes & infoRec->ImageGlyphBltMask)
+ (*infoRec->ValidateImageGlyphBlt)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyText8Mask)
+ (*infoRec->ValidatePolyText8)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PolyText16Mask)
+ (*infoRec->ValidatePolyText16)(pGC, changes, pDraw);
+
+ if(changes & infoRec->ImageText8Mask)
+ (*infoRec->ValidateImageText8)(pGC, changes, pDraw);
+
+ if(changes & infoRec->ImageText16Mask)
+ (*infoRec->ValidateImageText16)(pGC, changes, pDraw);
+
+ if(changes & infoRec->PushPixelsMask)
+ (*infoRec->ValidatePushPixels)(pGC, changes, pDraw);
+}
+
+
+static void
+XAADestroyGC(GCPtr pGC)
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+
+ if(pGCPriv->XAAOps != &XAAFallbackOps)
+ free(pGCPriv->XAAOps);
+
+ if(pGCPriv->DashPattern)
+ free(pGCPriv->DashPattern);
+
+ (*pGC->funcs->DestroyGC)(pGC);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAAChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+)
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+
+ /* we have to assume that shared memory pixmaps are dirty
+ because we can't wrap all operations on them */
+
+ if((mask & GCTile) && !pGC->tileIsPixel &&
+ PIXMAP_IS_SHARED(pGC->tile.pixmap))
+ {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->tile.pixmap);
+ pPixPriv->flags |= DIRTY;
+ }
+
+ if((mask & GCStipple) && PIXMAP_IS_SHARED(pGC->stipple)){
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pGC->stipple);
+ pPixPriv->flags |= DIRTY;
+ }
+}
+
+static void
+XAACopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst)
+{
+ XAA_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ XAA_GC_FUNC_EPILOGUE (pGCDst);
+}
+static void
+XAAChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects )
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+XAACopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ XAA_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ XAA_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+XAADestroyClip(GCPtr pGC)
+{
+ XAA_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ XAA_GC_FUNC_EPILOGUE (pGC);
+}
+
+/**** Pixmap Wrappers ****/
+
+
+
+static void
+XAAFillSpansPixmap(
+ DrawablePtr pDraw,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidthInit,
+ int fSorted
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->FillSpans)(pDraw, pGC, nInit, pptInit, pwidthInit, fSorted);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAASetSpansPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ char *pcharsrc,
+ register DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->SetSpans)(pDraw, pGC, pcharsrc, ppt, pwidth, nspans, fSorted);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPutImagePixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x, int y, int w, int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static RegionPtr
+XAACopyAreaPixmap(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ RegionPtr ret;
+
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc)))
+ {
+ if(infoRec->ReadPixmap && (pGC->alu == GXcopy) &&
+ (pSrc->bitsPerPixel == pDst->bitsPerPixel) &&
+ ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1])
+ == infoRec->FullPlanemasks[pSrc->depth - 1]))
+ {
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst));
+ pixPriv->flags |= DIRTY;
+
+ return (XAABitBlt( pSrc, pDst, pGC,
+ srcx, srcy, width, height, dstx, dsty,
+ XAADoImageRead, 0L));
+ } else
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ {
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
+ ret = (*pGC->ops->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ }
+ return ret;
+}
+
+static RegionPtr
+XAACopyPlanePixmap(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ RegionPtr ret;
+
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDst);
+
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ ret = (*pGC->ops->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAPolyPointPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ xPoint *pptInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyPoint)(pDraw, pGC, mode, npt, pptInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolylinesPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->Polylines)(pDraw, pGC, mode, npt, pptInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolySegmentPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolySegment)(pDraw, pGC, nseg, pSeg);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyRectanglePixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyRectangle)(pDraw, pGC, nRectsInit, pRectsInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyArcPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyArc)(pDraw, pGC, narcs, parcs);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAFillPolygonPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->FillPolygon)(pDraw, pGC, shape, mode, count, ptsIn);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolyFillRectPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyFillRect)(pDraw, pGC, nrectFill, prectInit);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAPolyFillArcPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyFillArc)(pDraw, pGC, narcs, parcs);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static int
+XAAPolyText8Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ int ret;
+
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ ret = (*pGC->ops->PolyText8)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static int
+XAAPolyText16Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ int ret;
+
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ ret = (*pGC->ops->PolyText16)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+ return ret;
+}
+
+static void
+XAAImageText8Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->ImageText8)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+static void
+XAAImageText16Pixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->ImageText16)(pDraw, pGC, x, y, count, chars);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+
+static void
+XAAImageGlyphBltPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->ImageGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPolyGlyphBltPixmap(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PolyGlyphBlt)(pDraw, pGC, xInit, yInit, nglyph,
+ ppci, pglyphBase);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+static void
+XAAPushPixelsPixmap(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy, int xOrg, int yOrg
+){
+ XAA_PIXMAP_OP_PROLOGUE(pGC, pDraw);
+ (*pGC->ops->PushPixels)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+ XAA_PIXMAP_OP_EPILOGUE(pGC);
+}
+
+GCOps XAAPixmapOps = {
+ XAAFillSpansPixmap, XAASetSpansPixmap,
+ XAAPutImagePixmap, XAACopyAreaPixmap,
+ XAACopyPlanePixmap, XAAPolyPointPixmap,
+ XAAPolylinesPixmap, XAAPolySegmentPixmap,
+ XAAPolyRectanglePixmap, XAAPolyArcPixmap,
+ XAAFillPolygonPixmap, XAAPolyFillRectPixmap,
+ XAAPolyFillArcPixmap, XAAPolyText8Pixmap,
+ XAAPolyText16Pixmap, XAAImageText8Pixmap,
+ XAAImageText16Pixmap, XAAImageGlyphBltPixmap,
+ XAAPolyGlyphBltPixmap, XAAPushPixelsPixmap,
+ {NULL} /* devPrivate */
+};
diff --git a/xorg-server/hw/xfree86/xaa/xaaImage.c b/xorg-server/hw/xfree86/xaa/xaaImage.c
index 4933beea3..c8d98c7d0 100644
--- a/xorg-server/hw/xfree86/xaa/xaaImage.c
+++ b/xorg-server/hw/xfree86/xaa/xaaImage.c
@@ -1,521 +1,521 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "servermd.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-void XAAMoveDWORDS_FixedBase(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *dest = *(src + 1);
- *dest = *(src + 2);
- *dest = *(src + 3);
- dwords -= 4;
- src += 4;
- }
-
- if(!dwords) return;
- *dest = *src;
- if(dwords == 1) return;
- *dest = *(src + 1);
- if(dwords == 2) return;
- *dest = *(src + 2);
-}
-
-void XAAMoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *(dest + 1) = *(src + 1);
- *(dest + 2) = *(src + 2);
- *(dest + 3) = *(src + 3);
- src += 4;
- dest += 4;
- dwords -= 4;
- }
- if(!dwords) return;
- *dest = *src;
- if(dwords == 1) return;
- *(dest + 1) = *(src + 1);
- if(dwords == 2) return;
- *(dest + 2) = *(src + 2);
-}
-
-void XAAMoveDWORDS_FixedSrc(
- register CARD32* dest,
- register CARD32* src,
- register int dwords )
-{
- while(dwords & ~0x03) {
- *dest = *src;
- *(dest + 1) = *src;
- *(dest + 2) = *src;
- *(dest + 3) = *src;
- dest += 4;
- dwords -= 4;
- }
- if(!dwords) return;
- *dest = *src;
- if(dwords == 1) return;
- *(dest + 1) = *src;
- if(dwords == 2) return;
- *(dest + 2) = *src;
-}
-
-static void
-XAAWritePixmap32To24(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *srcInit,
- int srcwidth, /* bytes */
- int rop,
- unsigned int planemask,
- int trans
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int count, dwords = bytes_to_int32(w * 3);
- CARD32 *src, *dst;
- Bool PlusOne = FALSE;
-
- if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((dwords * h) & 0x01)) {
- PlusOne = TRUE;
- }
-
- (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, 24, 24);
- (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, 0);
-
- if(dwords > infoRec->ImageWriteRange) {
- dst = (CARD32*)infoRec->ImageWriteBase;
- while(h--) {
- src = (CARD32*)srcInit;
- count = w;
-
- while(count >= 4) {
- *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
- *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
- src += 4;
- count -= 4;
- }
- switch(count) {
- case 0: break;
- case 1: *dst = src[0];
- break;
- case 2: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
- *dst = src[1] >> 8;
- break;
- default: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
- *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- *dst = src[2] >> 16;
- break;
- }
- srcInit += srcwidth;
- }
- } else {
- while(h--) {
- dst = (CARD32*)infoRec->ImageWriteBase;
- src = (CARD32*)srcInit;
- count = w;
-
- while(count >= 4) {
- dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
- dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
- dst += 3;
- src += 4;
- count -= 4;
- }
- switch(count) {
- case 0: break;
- case 1: dst[0] = src[0];
- break;
- case 2: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
- dst[1] = src[1] >> 8;
- break;
- default: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
- dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
- dst[2] = src[2] >> 16;
- break;
- }
- srcInit += srcwidth;
- }
- }
-
- if(PlusOne) {
- CARD32* base = (CARD32*)infoRec->ImageWriteBase;
- *base = 0x00000000;
- }
-
- if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-
-}
-
-void
-XAAWritePixmap (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth, /* bytes */
- int rop,
- unsigned int planemask,
- int trans,
- int bpp, int depth
-){
- XAAInfoRecPtr infoRec;
- int dwords, skipleft, Bpp;
- Bool beCareful, PlusOne;
-
- if((bpp == 32) && (pScrn->bitsPerPixel == 24)) {
- XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth,
- rop, planemask, trans);
- return;
- }
-
- infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- beCareful = PlusOne = FALSE;
- Bpp = bpp >> 3;
-
- if((skipleft = (long)src & 0x03L)) {
- if(!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- if(Bpp == 3)
- skipleft = 4 - skipleft;
- else
- skipleft /= Bpp;
-
- if((x < skipleft) && !(infoRec->ImageWriteFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- x -= skipleft;
- w += skipleft;
-
- if(Bpp == 3)
- src -= 3 * skipleft;
- else /* is this Alpha friendly ? */
- src = (unsigned char*)((long)src & ~0x03L);
- }
-
-BAD_ALIGNMENT:
-
- dwords = bytes_to_int32(w * Bpp);
-
- if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((dwords * h) & 0x01)) {
- PlusOne = TRUE;
- }
-
-
- (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, bpp, depth);
- (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, skipleft);
-
- if(beCareful) {
- /* in cases with bad alignment we have to be careful not
- to read beyond the end of the source */
- if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
- else beCareful = FALSE;
- }
-
- if(dwords > infoRec->ImageWriteRange) {
- while(h--) {
- XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src += srcwidth;
- }
- if(beCareful) {
- int shift = ((long)src & 0x03L) << 3;
- if(--dwords)
- XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
- *((CARD32*)infoRec->ImageWriteBase) = *((CARD32*)src) >> shift;
- }
- } else {
- if(srcwidth == (dwords << 2)) {
- int decrement = infoRec->ImageWriteRange/dwords;
-
- while(h > decrement) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords * decrement);
- src += (srcwidth * decrement);
- h -= decrement;
- }
- if(h) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords * h);
- if(beCareful) src += (srcwidth * h);
- }
- } else {
- while(h--) {
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src += srcwidth;
- }
- }
-
- if(beCareful) {
- int shift = ((long)src & 0x03L) << 3;
- if(--dwords)
- XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
- (CARD32*)src, dwords);
- src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
-
- ((CARD32*)infoRec->ImageWriteBase)[dwords] =
- *((CARD32*)src) >> shift;
- }
- }
-
- if(PlusOne) {
- CARD32* base = (CARD32*)infoRec->ImageWriteBase;
- *base = 0x00000000;
- }
-
- if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAWritePixmapScanline (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth, /* bytes */
- int rop,
- unsigned int planemask,
- int trans,
- int bpp, int depth
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3;
- Bool beCareful = FALSE;
- CARD32* base;
-
- if((skipleft = (long)src & 0x03L)) {
- if(!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- if(Bpp == 3)
- skipleft = 4 - skipleft;
- else
- skipleft /= Bpp;
-
- if((x < skipleft) && !(infoRec->ScanlineImageWriteFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
- skipleft = 0;
- beCareful = TRUE;
- goto BAD_ALIGNMENT;
- }
-
- x -= skipleft;
- w += skipleft;
-
- if(Bpp == 3)
- src -= 3 * skipleft;
- else
- src = (unsigned char*)((long)src & ~0x03L);
- }
-
-BAD_ALIGNMENT:
-
- dwords = bytes_to_int32(w * Bpp);
-
- (*infoRec->SetupForScanlineImageWrite)(
- pScrn, rop, planemask, trans, bpp, depth);
- (*infoRec->SubsequentScanlineImageWriteRect)(pScrn, x, y, w, h, skipleft);
-
- if(beCareful) {
- /* in cases with bad alignment we have to be careful not
- to read beyond the end of the source */
- if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
- else beCareful = FALSE;
- }
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
- XAAMoveDWORDS(base, (CARD32*)src, dwords);
- (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo++);
- src += srcwidth;
- if(bufferNo >= infoRec->NumScanlineImageWriteBuffers)
- bufferNo = 0;
- }
-
- if(beCareful) {
- int shift = ((long)src & 0x03L) << 3;
- base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
- if(--dwords)
- XAAMoveDWORDS(base,(CARD32*)src, dwords);
- src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
-
- base[dwords] = *((CARD32*)src) >> shift;
- (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo);
- }
-
- SET_SYNC_FLAG(infoRec);
-}
-
-
-void
-XAAPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- int bpp = BitsPerPixel(depth);
- Bool depthBug = FALSE;
- if(!w || !h) return;
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- depthBug = XAA_DEPTH_BUG(pGC);
-
- if(((format == ZPixmap) && infoRec->WritePixmap &&
- ((pDraw->bitsPerPixel == bpp) ||
- ((pDraw->bitsPerPixel == 24) && (bpp == 32) &&
- (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
- CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
- CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags)) ||
- ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap &&
- CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_COLORS(pGC,infoRec->WriteBitmapFlags) &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) ||
- ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap &&
- CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
- CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
- !(infoRec->WriteBitmapFlags & NO_PLANEMASK) &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))){
-
- int MaxBoxes = REGION_NUM_RECTS(pGC->pCompositeClip);
- BoxPtr pbox, pClipBoxes;
- int nboxes, srcx, srcy, srcwidth;
- xRectangle TheRect;
-
- TheRect.x = pDraw->x + x;
- TheRect.y = pDraw->y + y;
- TheRect.width = w;
- TheRect.height = h;
-
- if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
- pClipBoxes = xalloc(MaxBoxes * sizeof(BoxRec));
- if(!pClipBoxes) return;
- } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
-
- nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
- pbox = pClipBoxes;
-
- if(format == XYBitmap) {
- srcwidth = BitmapBytePad(leftPad + w);
- while(nboxes--) {
- srcx = pbox->x1 - TheRect.x + leftPad;
- srcy = pbox->y1 - TheRect.y;
- (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (unsigned char*)pImage +
- (srcwidth * srcy) + ((srcx >> 5) << 2),
- srcwidth, srcx & 31, pGC->fgPixel, pGC->bgPixel,
- pGC->alu, pGC->planemask);
- pbox++;
- }
- } else if(format == ZPixmap) {
- int Bpp = bpp >> 3;
- srcwidth = PixmapBytePad(leftPad + w, depth);
- while(nboxes--) {
- srcx = pbox->x1 - TheRect.x + leftPad;
- srcy = pbox->y1 - TheRect.y;
- (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (unsigned char*)pImage +
- (srcwidth * srcy) + (srcx * Bpp),
- srcwidth, pGC->alu, pGC->planemask, -1,
- Bpp << 3, depth);
- pbox++;
- }
- } else { /* XYPixmap */
- int depth = pGC->depth;
- int numBox, increment;
- unsigned long i, mask;
- BoxPtr pntBox;
-
- srcwidth = BitmapBytePad(w + leftPad);
- increment = h * srcwidth;
- i = 1 << (depth - 1);
- mask = ~0;
-
- if((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) &&
- (pGC->depth == 8)){
- i = 0x80000000; mask = 0xff000000;
- }
-
- for(; i & mask; i >>= 1, pImage += increment) {
- if(i & pGC->planemask) {
- pntBox = pbox;
- numBox = nboxes;
- while(numBox--) {
- srcx = pntBox->x1 - TheRect.x + leftPad;
- srcy = pntBox->y1 - TheRect.y;
- (*infoRec->WriteBitmap)(infoRec->pScrn,
- pntBox->x1, pntBox->y1,
- pntBox->x2 - pntBox->x1,
- pntBox->y2 - pntBox->y1,
- (unsigned char*)pImage +
- (srcwidth * srcy) + ((srcx >> 5) << 2),
- srcwidth, srcx & 31, ~0, 0, pGC->alu, i);
- pntBox++;
- }
- }
- }
-
- }
-
- if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
- xfree(pClipBoxes);
- } else
- XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad,
- format, pImage);
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+#include "servermd.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+void XAAMoveDWORDS_FixedBase(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *dest = *(src + 1);
+ *dest = *(src + 2);
+ *dest = *(src + 3);
+ dwords -= 4;
+ src += 4;
+ }
+
+ if(!dwords) return;
+ *dest = *src;
+ if(dwords == 1) return;
+ *dest = *(src + 1);
+ if(dwords == 2) return;
+ *dest = *(src + 2);
+}
+
+void XAAMoveDWORDS(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *(src + 1);
+ *(dest + 2) = *(src + 2);
+ *(dest + 3) = *(src + 3);
+ src += 4;
+ dest += 4;
+ dwords -= 4;
+ }
+ if(!dwords) return;
+ *dest = *src;
+ if(dwords == 1) return;
+ *(dest + 1) = *(src + 1);
+ if(dwords == 2) return;
+ *(dest + 2) = *(src + 2);
+}
+
+void XAAMoveDWORDS_FixedSrc(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords )
+{
+ while(dwords & ~0x03) {
+ *dest = *src;
+ *(dest + 1) = *src;
+ *(dest + 2) = *src;
+ *(dest + 3) = *src;
+ dest += 4;
+ dwords -= 4;
+ }
+ if(!dwords) return;
+ *dest = *src;
+ if(dwords == 1) return;
+ *(dest + 1) = *src;
+ if(dwords == 2) return;
+ *(dest + 2) = *src;
+}
+
+static void
+XAAWritePixmap32To24(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *srcInit,
+ int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask,
+ int trans
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int count, dwords = bytes_to_int32(w * 3);
+ CARD32 *src, *dst;
+ Bool PlusOne = FALSE;
+
+ if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+ (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, 24, 24);
+ (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, 0);
+
+ if(dwords > infoRec->ImageWriteRange) {
+ dst = (CARD32*)infoRec->ImageWriteBase;
+ while(h--) {
+ src = (CARD32*)srcInit;
+ count = w;
+
+ while(count >= 4) {
+ *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ *dst = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
+ src += 4;
+ count -= 4;
+ }
+ switch(count) {
+ case 0: break;
+ case 1: *dst = src[0];
+ break;
+ case 2: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = src[1] >> 8;
+ break;
+ default: *dst = (src[0] & 0x00ffffff) | (src[1] << 24);
+ *dst = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ *dst = src[2] >> 16;
+ break;
+ }
+ srcInit += srcwidth;
+ }
+ } else {
+ while(h--) {
+ dst = (CARD32*)infoRec->ImageWriteBase;
+ src = (CARD32*)srcInit;
+ count = w;
+
+ while(count >= 4) {
+ dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ dst[2] = ((src[2] >> 16) & 0x000000ff) | (src[3] << 8);
+ dst += 3;
+ src += 4;
+ count -= 4;
+ }
+ switch(count) {
+ case 0: break;
+ case 1: dst[0] = src[0];
+ break;
+ case 2: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = src[1] >> 8;
+ break;
+ default: dst[0] = (src[0] & 0x00ffffff) | (src[1] << 24);
+ dst[1] = ((src[1] >> 8) & 0x0000ffff) | (src[2] << 16);
+ dst[2] = src[2] >> 16;
+ break;
+ }
+ srcInit += srcwidth;
+ }
+ }
+
+ if(PlusOne) {
+ CARD32* base = (CARD32*)infoRec->ImageWriteBase;
+ *base = 0x00000000;
+ }
+
+ if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+
+}
+
+void
+XAAWritePixmap (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask,
+ int trans,
+ int bpp, int depth
+){
+ XAAInfoRecPtr infoRec;
+ int dwords, skipleft, Bpp;
+ Bool beCareful, PlusOne;
+
+ if((bpp == 32) && (pScrn->bitsPerPixel == 24)) {
+ XAAWritePixmap32To24(pScrn, x, y, w, h, src, srcwidth,
+ rop, planemask, trans);
+ return;
+ }
+
+ infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ beCareful = PlusOne = FALSE;
+ Bpp = bpp >> 3;
+
+ if((skipleft = (long)src & 0x03L)) {
+ if(!(infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ if(Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ if((x < skipleft) && !(infoRec->ImageWriteFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ x -= skipleft;
+ w += skipleft;
+
+ if(Bpp == 3)
+ src -= 3 * skipleft;
+ else /* is this Alpha friendly ? */
+ src = (unsigned char*)((long)src & ~0x03L);
+ }
+
+BAD_ALIGNMENT:
+
+ dwords = bytes_to_int32(w * Bpp);
+
+ if((infoRec->ImageWriteFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((dwords * h) & 0x01)) {
+ PlusOne = TRUE;
+ }
+
+
+ (*infoRec->SetupForImageWrite)(pScrn, rop, planemask, trans, bpp, depth);
+ (*infoRec->SubsequentImageWriteRect)(pScrn, x, y, w, h, skipleft);
+
+ if(beCareful) {
+ /* in cases with bad alignment we have to be careful not
+ to read beyond the end of the source */
+ if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
+ else beCareful = FALSE;
+ }
+
+ if(dwords > infoRec->ImageWriteRange) {
+ while(h--) {
+ XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ if(beCareful) {
+ int shift = ((long)src & 0x03L) << 3;
+ if(--dwords)
+ XAAMoveDWORDS_FixedBase((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
+ *((CARD32*)infoRec->ImageWriteBase) = *((CARD32*)src) >> shift;
+ }
+ } else {
+ if(srcwidth == (dwords << 2)) {
+ int decrement = infoRec->ImageWriteRange/dwords;
+
+ while(h > decrement) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords * decrement);
+ src += (srcwidth * decrement);
+ h -= decrement;
+ }
+ if(h) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords * h);
+ if(beCareful) src += (srcwidth * h);
+ }
+ } else {
+ while(h--) {
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src += srcwidth;
+ }
+ }
+
+ if(beCareful) {
+ int shift = ((long)src & 0x03L) << 3;
+ if(--dwords)
+ XAAMoveDWORDS((CARD32*)infoRec->ImageWriteBase,
+ (CARD32*)src, dwords);
+ src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
+
+ ((CARD32*)infoRec->ImageWriteBase)[dwords] =
+ *((CARD32*)src) >> shift;
+ }
+ }
+
+ if(PlusOne) {
+ CARD32* base = (CARD32*)infoRec->ImageWriteBase;
+ *base = 0x00000000;
+ }
+
+ if(infoRec->ImageWriteFlags & SYNC_AFTER_IMAGE_WRITE)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAWritePixmapScanline (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth, /* bytes */
+ int rop,
+ unsigned int planemask,
+ int trans,
+ int bpp, int depth
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int dwords, skipleft, bufferNo = 0, Bpp = bpp >> 3;
+ Bool beCareful = FALSE;
+ CARD32* base;
+
+ if((skipleft = (long)src & 0x03L)) {
+ if(!(infoRec->ScanlineImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ if(Bpp == 3)
+ skipleft = 4 - skipleft;
+ else
+ skipleft /= Bpp;
+
+ if((x < skipleft) && !(infoRec->ScanlineImageWriteFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)) {
+ skipleft = 0;
+ beCareful = TRUE;
+ goto BAD_ALIGNMENT;
+ }
+
+ x -= skipleft;
+ w += skipleft;
+
+ if(Bpp == 3)
+ src -= 3 * skipleft;
+ else
+ src = (unsigned char*)((long)src & ~0x03L);
+ }
+
+BAD_ALIGNMENT:
+
+ dwords = bytes_to_int32(w * Bpp);
+
+ (*infoRec->SetupForScanlineImageWrite)(
+ pScrn, rop, planemask, trans, bpp, depth);
+ (*infoRec->SubsequentScanlineImageWriteRect)(pScrn, x, y, w, h, skipleft);
+
+ if(beCareful) {
+ /* in cases with bad alignment we have to be careful not
+ to read beyond the end of the source */
+ if(((x * Bpp) + (dwords << 2)) > srcwidth) h--;
+ else beCareful = FALSE;
+ }
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
+ XAAMoveDWORDS(base, (CARD32*)src, dwords);
+ (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo++);
+ src += srcwidth;
+ if(bufferNo >= infoRec->NumScanlineImageWriteBuffers)
+ bufferNo = 0;
+ }
+
+ if(beCareful) {
+ int shift = ((long)src & 0x03L) << 3;
+ base = (CARD32*)infoRec->ScanlineImageWriteBuffers[bufferNo];
+ if(--dwords)
+ XAAMoveDWORDS(base,(CARD32*)src, dwords);
+ src = (unsigned char*)((long)(src + (dwords << 2)) & ~0x03L);
+
+ base[dwords] = *((CARD32*)src) >> shift;
+ (*infoRec->SubsequentImageWriteScanline)(pScrn, bufferNo);
+ }
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+
+void
+XAAPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ int bpp = BitsPerPixel(depth);
+ Bool depthBug = FALSE;
+ if(!w || !h) return;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ depthBug = XAA_DEPTH_BUG(pGC);
+
+ if(((format == ZPixmap) && infoRec->WritePixmap &&
+ ((pDraw->bitsPerPixel == bpp) ||
+ ((pDraw->bitsPerPixel == 24) && (bpp == 32) &&
+ (infoRec->WritePixmapFlags & CONVERT_32BPP_TO_24BPP))) &&
+ CHECK_ROP(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->WritePixmapFlags) &&
+ CHECK_NO_GXCOPY(pGC,infoRec->WritePixmapFlags)) ||
+ ((format == XYBitmap) && !depthBug && infoRec->WriteBitmap &&
+ CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_COLORS(pGC,infoRec->WriteBitmapFlags) &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) ||
+ ((format == XYPixmap) && !depthBug && infoRec->WriteBitmap &&
+ CHECK_ROP(pGC,infoRec->WriteBitmapFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->WriteBitmapFlags) &&
+ !(infoRec->WriteBitmapFlags & NO_PLANEMASK) &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))){
+
+ int MaxBoxes = REGION_NUM_RECTS(pGC->pCompositeClip);
+ BoxPtr pbox, pClipBoxes;
+ int nboxes, srcx, srcy, srcwidth;
+ xRectangle TheRect;
+
+ TheRect.x = pDraw->x + x;
+ TheRect.y = pDraw->y + y;
+ TheRect.width = w;
+ TheRect.height = h;
+
+ if(MaxBoxes > (infoRec->PreAllocSize/sizeof(BoxRec))) {
+ pClipBoxes = malloc(MaxBoxes * sizeof(BoxRec));
+ if(!pClipBoxes) return;
+ } else pClipBoxes = (BoxPtr)infoRec->PreAllocMem;
+
+ nboxes = XAAGetRectClipBoxes(pGC, pClipBoxes, 1, &TheRect);
+ pbox = pClipBoxes;
+
+ if(format == XYBitmap) {
+ srcwidth = BitmapBytePad(leftPad + w);
+ while(nboxes--) {
+ srcx = pbox->x1 - TheRect.x + leftPad;
+ srcy = pbox->y1 - TheRect.y;
+ (*infoRec->WriteBitmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (unsigned char*)pImage +
+ (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31, pGC->fgPixel, pGC->bgPixel,
+ pGC->alu, pGC->planemask);
+ pbox++;
+ }
+ } else if(format == ZPixmap) {
+ int Bpp = bpp >> 3;
+ srcwidth = PixmapBytePad(leftPad + w, depth);
+ while(nboxes--) {
+ srcx = pbox->x1 - TheRect.x + leftPad;
+ srcy = pbox->y1 - TheRect.y;
+ (*infoRec->WritePixmap)(infoRec->pScrn, pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (unsigned char*)pImage +
+ (srcwidth * srcy) + (srcx * Bpp),
+ srcwidth, pGC->alu, pGC->planemask, -1,
+ Bpp << 3, depth);
+ pbox++;
+ }
+ } else { /* XYPixmap */
+ int depth = pGC->depth;
+ int numBox, increment;
+ unsigned long i, mask;
+ BoxPtr pntBox;
+
+ srcwidth = BitmapBytePad(w + leftPad);
+ increment = h * srcwidth;
+ i = 1 << (depth - 1);
+ mask = ~0;
+
+ if((infoRec->pScrn->overlayFlags & OVERLAY_8_32_PLANAR) &&
+ (pGC->depth == 8)){
+ i = 0x80000000; mask = 0xff000000;
+ }
+
+ for(; i & mask; i >>= 1, pImage += increment) {
+ if(i & pGC->planemask) {
+ pntBox = pbox;
+ numBox = nboxes;
+ while(numBox--) {
+ srcx = pntBox->x1 - TheRect.x + leftPad;
+ srcy = pntBox->y1 - TheRect.y;
+ (*infoRec->WriteBitmap)(infoRec->pScrn,
+ pntBox->x1, pntBox->y1,
+ pntBox->x2 - pntBox->x1,
+ pntBox->y2 - pntBox->y1,
+ (unsigned char*)pImage +
+ (srcwidth * srcy) + ((srcx >> 5) << 2),
+ srcwidth, srcx & 31, ~0, 0, pGC->alu, i);
+ pntBox++;
+ }
+ }
+ }
+
+ }
+
+ if(pClipBoxes != (BoxPtr)infoRec->PreAllocMem)
+ free(pClipBoxes);
+ } else
+ XAAFallbackOps.PutImage(pDraw, pGC, depth, x, y, w, h, leftPad,
+ format, pImage);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaInit.c b/xorg-server/hw/xfree86/xaa/xaaInit.c
index 7d4583dc2..58efb6a82 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInit.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInit.c
@@ -1,624 +1,624 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-#ifdef COMPOSITE
-#include "cw.h"
-#endif
-
-#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */
-
-#define MIN_OFFPIX_SIZE (320*200)
-
-static Bool XAACloseScreen(int i, ScreenPtr pScreen);
-static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format, unsigned long planemask,
- char *pdstLine);
-static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
- int *pwidth, int nspans, char *pdstStart);
-static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
- unsigned usage_hint);
-static Bool XAADestroyPixmap(PixmapPtr pPixmap);
-static Bool XAAEnterVT (int index, int flags);
-static void XAALeaveVT (int index, int flags);
-static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
-static void XAAEnableDisableFBAccess (int index, Bool enable);
-static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
-
-static int XAAScreenKeyIndex;
-static DevPrivateKey XAAScreenKey = &XAAScreenKeyIndex;
-static int XAAGCKeyIndex;
-static DevPrivateKey XAAGCKey = &XAAGCKeyIndex;
-static int XAAPixmapKeyIndex;
-static DevPrivateKey XAAPixmapKey = &XAAPixmapKeyIndex;
-
-DevPrivateKey XAAGetScreenKey(void) {
- return XAAScreenKey;
-}
-
-DevPrivateKey XAAGetGCKey(void) {
- return XAAGCKey;
-}
-
-DevPrivateKey XAAGetPixmapKey(void) {
- return XAAPixmapKey;
-}
-
-/* temp kludge */
-static Bool SwitchedOut = FALSE;
-
-XAAInfoRecPtr
-XAACreateInfoRec(void)
-{
- XAAInfoRecPtr infoRec;
-
- infoRec = xcalloc(1, sizeof(XAAInfoRec));
- if(infoRec)
- infoRec->CachePixelGranularity = -1;
-
- return infoRec;
-}
-
-void
-XAADestroyInfoRec(XAAInfoRecPtr infoRec)
-{
- if(!infoRec) return;
-
- if(infoRec->ClosePixmapCache)
- (*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen);
-
- if(infoRec->PreAllocMem)
- xfree(infoRec->PreAllocMem);
-
- if(infoRec->PixmapCachePrivate)
- xfree(infoRec->PixmapCachePrivate);
-
- xfree(infoRec);
-}
-
-
-Bool
-XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAScreenPtr pScreenPriv;
- int i;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- /* Return successfully if no acceleration wanted */
- if (!infoRec)
- return TRUE;
-
- if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec)))
- return FALSE;
-
- if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec)))
- return FALSE;
-
- if (!(pScreenPriv = xalloc(sizeof(XAAScreenRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
-
- if(!xf86FBManagerRunning(pScreen))
- infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
- if(!(infoRec->Flags & LINEAR_FRAMEBUFFER))
- infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
-
- if(!infoRec->FullPlanemask) { /* for backwards compatibility */
- infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
- infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
- }
-
- for(i = 0; i < 32; i++) {
- if(!infoRec->FullPlanemasks[i]) /* keep any set by caller */
- infoRec->FullPlanemasks[i] = (1 << (i+1)) - 1;
- }
-
- if(!XAAInitAccel(pScreen, infoRec)) return FALSE;
- pScreenPriv->AccelInfoRec = infoRec;
- infoRec->ScratchGC.pScreen = pScreen;
-
-
- if(!infoRec->GetImage)
- infoRec->GetImage = XAAGetImage;
- if(!infoRec->GetSpans)
- infoRec->GetSpans = XAAGetSpans;
- if(!infoRec->CopyWindow)
- infoRec->CopyWindow = XAACopyWindow;
-
- pScreenPriv->CreateGC = pScreen->CreateGC;
- pScreen->CreateGC = XAACreateGC;
- pScreenPriv->CloseScreen = pScreen->CloseScreen;
- pScreen->CloseScreen = XAACloseScreen;
- pScreenPriv->GetImage = pScreen->GetImage;
- pScreen->GetImage = infoRec->GetImage;
- pScreenPriv->GetSpans = pScreen->GetSpans;
- pScreen->GetSpans = infoRec->GetSpans;
- pScreenPriv->CopyWindow = pScreen->CopyWindow;
- pScreen->CopyWindow = infoRec->CopyWindow;
- pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
- pScreen->CreatePixmap = XAACreatePixmap;
- pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
- pScreen->DestroyPixmap = XAADestroyPixmap;
- pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
- pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes;
-
- pScreenPriv->EnterVT = pScrn->EnterVT;
- pScrn->EnterVT = XAAEnterVT;
- pScreenPriv->LeaveVT = pScrn->LeaveVT;
- pScrn->LeaveVT = XAALeaveVT;
- pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
- pScrn->SetDGAMode = XAASetDGAMode;
- pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
- pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
-
- pScreenPriv->WindowExposures = pScreen->WindowExposures;
- if (ps)
- {
- pScreenPriv->Composite = ps->Composite;
- ps->Composite = XAAComposite;
- pScreenPriv->Glyphs = ps->Glyphs;
- ps->Glyphs = XAAGlyphs;
- }
- if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
- XAASetupOverlay8_32Planar(pScreen);
-
- infoRec->PreAllocMem = xalloc(MAX_PREALLOC_MEM);
- if(infoRec->PreAllocMem)
- infoRec->PreAllocSize = MAX_PREALLOC_MEM;
-
- if(infoRec->Flags & PIXMAP_CACHE)
- xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache,
- (pointer)infoRec);
-
- if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
- miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
-
-#ifdef COMPOSITE
- /* Initialize the composite wrapper. This needs to happen after the
- * wrapping above (so it comes before us), but before all other extensions,
- * so it doesn't confuse them. (particularly damage).
- */
- miInitializeCompositeWrapper(pScreen);
-#endif
-
- return TRUE;
-}
-
-
-
-static Bool
-XAACloseScreen (int i, ScreenPtr pScreen)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
-
- pScrn->EnterVT = pScreenPriv->EnterVT;
- pScrn->LeaveVT = pScreenPriv->LeaveVT;
- pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess;
-
- pScreen->CreateGC = pScreenPriv->CreateGC;
- pScreen->CloseScreen = pScreenPriv->CloseScreen;
- pScreen->GetImage = pScreenPriv->GetImage;
- pScreen->GetSpans = pScreenPriv->GetSpans;
- pScreen->CopyWindow = pScreenPriv->CopyWindow;
- pScreen->WindowExposures = pScreenPriv->WindowExposures;
- pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
- pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
- pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
-
- /* We leave it up to the client to free the XAAInfoRec */
-
- xfree ((pointer) pScreenPriv);
-
- return (*pScreen->CloseScreen) (i, pScreen);
-}
-
-static void
-XAAGetImage (
- DrawablePtr pDraw,
- int sx, int sy, int w, int h,
- unsigned int format,
- unsigned long planemask,
- char *pdstLine
-)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = infoRec->pScrn;
-
- if(pScrn->vtSema &&
- ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw)))
- {
- if(infoRec->ReadPixmap && (format == ZPixmap) &&
- ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
- infoRec->FullPlanemasks[pDraw->depth - 1]) &&
- (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth)))
- {
- (*infoRec->ReadPixmap)(pScrn,
- sx + pDraw->x, sy + pDraw->y, w, h,
- (unsigned char *)pdstLine,
- PixmapBytePad(w, pDraw->depth),
- pDraw->bitsPerPixel, pDraw->depth);
- return;
- }
- SYNC_CHECK(pDraw);
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, GetImage);
- (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
- XAA_SCREEN_EPILOGUE (pScreen, GetImage, XAAGetImage);
-}
-
-static void
-XAAGetSpans (
- DrawablePtr pDraw,
- int wMax,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- char *pdstStart
-)
-{
- ScreenPtr pScreen = pDraw->pScreen;
- XAA_SCREEN_PROLOGUE (pScreen, GetSpans);
- if(xf86Screens[pScreen->myNum]->vtSema &&
- ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
- SYNC_CHECK(pDraw);
- }
- (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart);
- XAA_SCREEN_EPILOGUE (pScreen, GetSpans, XAAGetSpans);
-}
-
-
-static int
-XAAPixmapBPP (ScreenPtr pScreen, int depth)
-{
- PixmapPtr pPix;
- int bpp;
- DestroyPixmapProcPtr destroyPixmap;
-
- XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth,
- CREATE_PIXMAP_USAGE_SCRATCH);
- XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
- if (!pPix)
- return 0;
- bpp = pPix->drawable.bitsPerPixel;
- destroyPixmap = pScreen->DestroyPixmap;
- XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- (*pScreen->DestroyPixmap) (pPix);
- XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, destroyPixmap);
- return bpp;
-}
-
-static void
-XAAInitializeOffscreenDepths (ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- int d, dep;
-
- infoRec->offscreenDepthsInitialized = TRUE;
- infoRec->offscreenDepths = 0;
- if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
- for (d = 0; d < pScreen->numDepths; d++) {
- dep = pScreen->allowedDepths[d].depth;
- if (XAAPixmapBPP (pScreen, dep) == pScrn->bitsPerPixel)
- infoRec->offscreenDepths |= (1 << (dep - 1));
- }
- }
-}
-
-static PixmapPtr
-XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAPixmapPtr pPriv;
- PixmapPtr pPix = NULL;
- int size = w * h;
-
- if (w > 32767 || h > 32767)
- return NullPixmap;
-
- if (!infoRec->offscreenDepthsInitialized)
- XAAInitializeOffscreenDepths (pScreen);
-
- if(pScrn->vtSema &&
- (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
- (infoRec->offscreenDepths & (1 << (depth - 1))) &&
- (size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
- (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
- (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight)) )
- {
- PixmapLinkPtr pLink;
- PixmapPtr pScreenPix;
- FBAreaPtr area;
- int gran = 0;
-
- switch(pScrn->bitsPerPixel) {
- case 24:
- case 8: gran = 4; break;
- case 16: gran = 2; break;
- case 32: gran = 1; break;
- default: break;
- }
-
- if(BITMAP_SCANLINE_PAD == 64)
- gran *= 2;
-
- if(!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0,
- XAARemoveAreaCallback, NULL))) {
- goto BAILOUT;
- }
-
- if(!(pLink = xalloc(sizeof(PixmapLink)))) {
- xf86FreeOffscreenArea(area);
- goto BAILOUT;
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
- XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
-
- if (!pPix) {
- xfree (pLink);
- xf86FreeOffscreenArea(area);
- goto BAILOUT;
- }
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- pPix->drawable.x = area->box.x1;
- pPix->drawable.y = area->box.y1;
- pPix->drawable.width = w;
- pPix->drawable.height = h;
- pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel;
- pPix->devKind = pScreenPix->devKind;
- pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
- area->devPrivate.ptr = pPix;
-
- pPriv->flags = OFFSCREEN;
- pPriv->offscreenArea = area;
- pPriv->freeData = FALSE;
-
- pLink->next = infoRec->OffscreenPixmaps;
- pLink->pPix = pPix;
- infoRec->OffscreenPixmaps = pLink;
- return pPix;
- }
-BAILOUT:
- XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
- pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
- XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
-
- if(pPix) {
- pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- pPriv->flags = 0;
- pPriv->offscreenArea = NULL;
- pPriv->freeData = FALSE;
- if(!w || !h) /* either scratch or shared memory */
- pPriv->flags |= SHARED_PIXMAP;
- }
-
- return pPix;
-}
-
-static Bool
-XAADestroyPixmap(PixmapPtr pPix)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- Bool ret;
-
- if(pPix->refcnt == 1) {
- if(pPriv->flags & OFFSCREEN) {
- if(pPriv->flags & DGA_PIXMAP)
- xfree(pPriv->offscreenArea);
- else {
- FBAreaPtr area = pPriv->offscreenArea;
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- PixmapLinkPtr prev = NULL;
-
- while(pLink->pPix != pPix) {
- prev = pLink;
- pLink = pLink->next;
- }
-
- if(prev) prev->next = pLink->next;
- else infoRec->OffscreenPixmaps = pLink->next;
-
- if(!area) area = pLink->area;
-
- xf86FreeOffscreenArea(area);
- pPriv->offscreenArea = NULL;
- xfree(pLink);
- }
- }
-
- if(pPriv->freeData) { /* pixmaps that were once in video ram */
- xfree(pPix->devPrivate.ptr);
- pPix->devPrivate.ptr = NULL;
- }
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
- ret = (*pScreen->DestroyPixmap) (pPix);
- XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, XAADestroyPixmap);
-
- return ret;
-}
-
-static Bool
-XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- Bool ret;
-
- XAA_SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes);
- ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
- XAA_SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, XAAChangeWindowAttributes);
-
- /* we have to assume that shared memory pixmaps are dirty
- because we can't wrap operations on them */
-
- if((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) &&
- PIXMAP_IS_SHARED(pWin->background.pixmap))
- {
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap);
- pPixPriv->flags |= DIRTY;
- }
- if((mask & CWBorderPixmap) && !(pWin->borderIsPixel) &&
- PIXMAP_IS_SHARED(pWin->border.pixmap))
- {
- XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap);
- pPixPriv->flags |= DIRTY;
- }
-
- return ret;
-}
-
-
-
-/* These two aren't really needed for anything */
-
-static Bool
-XAAEnterVT(int index, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
-
- return((*pScreenPriv->EnterVT)(index, flags));
-}
-
-static void
-XAALeaveVT(int index, int flags)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
- XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
-
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
-
- (*pScreenPriv->LeaveVT)(index, flags);
-}
-
-typedef struct {
- Bool UsingPixmapCache;
- Bool CanDoColor8x8;
- Bool CanDoMono8x8;
-} SavedCacheState, *SavedCacheStatePtr;
-
-static int
-XAASetDGAMode(int index, int num, DGADevicePtr devRet)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
- int ret;
-
- if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
- SavedCacheStatePtr state = (SavedCacheStatePtr)infoRec->dgaSaves;
-
- infoRec->UsingPixmapCache = state->UsingPixmapCache;
- infoRec->CanDoColor8x8 = state->CanDoColor8x8;
- infoRec->CanDoMono8x8 = state->CanDoMono8x8;
- xfree(infoRec->dgaSaves);
- infoRec->dgaSaves = NULL;
- }
-
- ret = (*pScreenPriv->SetDGAMode)(index, num, devRet);
- if(ret != Success) return ret;
-
- if(num && devRet->pPix) { /* accelerate this pixmap */
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
- FBAreaPtr area;
-
- if((area = xalloc(sizeof(FBArea)))) {
- area->pScreen = pScreen;
- area->box.x1 = 0;
- area->box.x2 = 0;
- area->box.y1 = devRet->mode->pixmapWidth;
- area->box.y2 = devRet->mode->pixmapHeight;
- area->granularity = 0;
- area->MoveAreaCallback = 0;
- area->RemoveAreaCallback = 0;
- area->devPrivate.ptr = 0;
-
- pixPriv->flags |= OFFSCREEN | DGA_PIXMAP;
- pixPriv->offscreenArea = area;
-
- if(!infoRec->dgaSaves) { /* save pixmap cache state */
- SavedCacheStatePtr state = xalloc(sizeof(SavedCacheState));
-
- state->UsingPixmapCache = infoRec->UsingPixmapCache;
- state->CanDoColor8x8 = infoRec->CanDoColor8x8;
- state->CanDoMono8x8 = infoRec->CanDoMono8x8;
- infoRec->dgaSaves = (char*)state;
-
- infoRec->UsingPixmapCache = FALSE;
- if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8)
- infoRec->CanDoMono8x8 = FALSE;
- if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8)
- infoRec->CanDoColor8x8 = FALSE;
- }
- }
- }
-
- return ret;
-}
-
-
-
-static void
-XAAEnableDisableFBAccess (int index, Bool enable)
-{
- ScreenPtr pScreen = screenInfo.screens[index];
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAScreenPtr pScreenPriv =
- (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
-
- if(!enable) {
- if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
- XAAMoveOutOffscreenPixmaps(pScreen);
- if(infoRec->Flags & PIXMAP_CACHE)
- XAAInvalidatePixmapCache(pScreen);
- SwitchedOut = TRUE;
- }
-
- (*pScreenPriv->EnableDisableFBAccess)(index, enable);
-
- if(enable) {
- if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
- XAAMoveInOffscreenPixmaps(pScreen);
- SwitchedOut = FALSE;
- }
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+#ifdef COMPOSITE
+#include "cw.h"
+#endif
+
+#define MAX_PREALLOC_MEM 65536 /* MUST be >= 1024 */
+
+#define MIN_OFFPIX_SIZE (320*200)
+
+static Bool XAACloseScreen(int i, ScreenPtr pScreen);
+static void XAAGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask,
+ char *pdstLine);
+static void XAAGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart);
+static PixmapPtr XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth,
+ unsigned usage_hint);
+static Bool XAADestroyPixmap(PixmapPtr pPixmap);
+static Bool XAAEnterVT (int index, int flags);
+static void XAALeaveVT (int index, int flags);
+static int XAASetDGAMode(int index, int num, DGADevicePtr devRet);
+static void XAAEnableDisableFBAccess (int index, Bool enable);
+static Bool XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask);
+
+static int XAAScreenKeyIndex;
+static DevPrivateKey XAAScreenKey = &XAAScreenKeyIndex;
+static int XAAGCKeyIndex;
+static DevPrivateKey XAAGCKey = &XAAGCKeyIndex;
+static int XAAPixmapKeyIndex;
+static DevPrivateKey XAAPixmapKey = &XAAPixmapKeyIndex;
+
+DevPrivateKey XAAGetScreenKey(void) {
+ return XAAScreenKey;
+}
+
+DevPrivateKey XAAGetGCKey(void) {
+ return XAAGCKey;
+}
+
+DevPrivateKey XAAGetPixmapKey(void) {
+ return XAAPixmapKey;
+}
+
+/* temp kludge */
+static Bool SwitchedOut = FALSE;
+
+XAAInfoRecPtr
+XAACreateInfoRec(void)
+{
+ XAAInfoRecPtr infoRec;
+
+ infoRec = calloc(1, sizeof(XAAInfoRec));
+ if(infoRec)
+ infoRec->CachePixelGranularity = -1;
+
+ return infoRec;
+}
+
+void
+XAADestroyInfoRec(XAAInfoRecPtr infoRec)
+{
+ if(!infoRec) return;
+
+ if(infoRec->ClosePixmapCache)
+ (*infoRec->ClosePixmapCache)(infoRec->pScrn->pScreen);
+
+ if(infoRec->PreAllocMem)
+ free(infoRec->PreAllocMem);
+
+ if(infoRec->PixmapCachePrivate)
+ free(infoRec->PixmapCachePrivate);
+
+ free(infoRec);
+}
+
+
+Bool
+XAAInit(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAScreenPtr pScreenPriv;
+ int i;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ /* Return successfully if no acceleration wanted */
+ if (!infoRec)
+ return TRUE;
+
+ if (!dixRequestPrivate(XAAGCKey, sizeof(XAAGCRec)))
+ return FALSE;
+
+ if (!dixRequestPrivate(XAAPixmapKey, sizeof(XAAPixmapRec)))
+ return FALSE;
+
+ if (!(pScreenPriv = malloc(sizeof(XAAScreenRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, XAAScreenKey, pScreenPriv);
+
+ if(!xf86FBManagerRunning(pScreen))
+ infoRec->Flags &= ~(PIXMAP_CACHE | OFFSCREEN_PIXMAPS);
+ if(!(infoRec->Flags & LINEAR_FRAMEBUFFER))
+ infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
+
+ if(!infoRec->FullPlanemask) { /* for backwards compatibility */
+ infoRec->FullPlanemask = (1 << pScrn->depth) - 1;
+ infoRec->FullPlanemasks[pScrn->depth - 1] = infoRec->FullPlanemask;
+ }
+
+ for(i = 0; i < 32; i++) {
+ if(!infoRec->FullPlanemasks[i]) /* keep any set by caller */
+ infoRec->FullPlanemasks[i] = (1 << (i+1)) - 1;
+ }
+
+ if(!XAAInitAccel(pScreen, infoRec)) return FALSE;
+ pScreenPriv->AccelInfoRec = infoRec;
+ infoRec->ScratchGC.pScreen = pScreen;
+
+
+ if(!infoRec->GetImage)
+ infoRec->GetImage = XAAGetImage;
+ if(!infoRec->GetSpans)
+ infoRec->GetSpans = XAAGetSpans;
+ if(!infoRec->CopyWindow)
+ infoRec->CopyWindow = XAACopyWindow;
+
+ pScreenPriv->CreateGC = pScreen->CreateGC;
+ pScreen->CreateGC = XAACreateGC;
+ pScreenPriv->CloseScreen = pScreen->CloseScreen;
+ pScreen->CloseScreen = XAACloseScreen;
+ pScreenPriv->GetImage = pScreen->GetImage;
+ pScreen->GetImage = infoRec->GetImage;
+ pScreenPriv->GetSpans = pScreen->GetSpans;
+ pScreen->GetSpans = infoRec->GetSpans;
+ pScreenPriv->CopyWindow = pScreen->CopyWindow;
+ pScreen->CopyWindow = infoRec->CopyWindow;
+ pScreenPriv->CreatePixmap = pScreen->CreatePixmap;
+ pScreen->CreatePixmap = XAACreatePixmap;
+ pScreenPriv->DestroyPixmap = pScreen->DestroyPixmap;
+ pScreen->DestroyPixmap = XAADestroyPixmap;
+ pScreenPriv->ChangeWindowAttributes = pScreen->ChangeWindowAttributes;
+ pScreen->ChangeWindowAttributes = XAAChangeWindowAttributes;
+
+ pScreenPriv->EnterVT = pScrn->EnterVT;
+ pScrn->EnterVT = XAAEnterVT;
+ pScreenPriv->LeaveVT = pScrn->LeaveVT;
+ pScrn->LeaveVT = XAALeaveVT;
+ pScreenPriv->SetDGAMode = pScrn->SetDGAMode;
+ pScrn->SetDGAMode = XAASetDGAMode;
+ pScreenPriv->EnableDisableFBAccess = pScrn->EnableDisableFBAccess;
+ pScrn->EnableDisableFBAccess = XAAEnableDisableFBAccess;
+
+ pScreenPriv->WindowExposures = pScreen->WindowExposures;
+ if (ps)
+ {
+ pScreenPriv->Composite = ps->Composite;
+ ps->Composite = XAAComposite;
+ pScreenPriv->Glyphs = ps->Glyphs;
+ ps->Glyphs = XAAGlyphs;
+ }
+ if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)
+ XAASetupOverlay8_32Planar(pScreen);
+
+ infoRec->PreAllocMem = malloc(MAX_PREALLOC_MEM);
+ if(infoRec->PreAllocMem)
+ infoRec->PreAllocSize = MAX_PREALLOC_MEM;
+
+ if(infoRec->Flags & PIXMAP_CACHE)
+ xf86RegisterFreeBoxCallback(pScreen, infoRec->InitPixmapCache,
+ (pointer)infoRec);
+
+ if(infoRec->Flags & MICROSOFT_ZERO_LINE_BIAS)
+ miSetZeroLineBias(pScreen, OCTANT1 | OCTANT2 | OCTANT3 | OCTANT4);
+
+#ifdef COMPOSITE
+ /* Initialize the composite wrapper. This needs to happen after the
+ * wrapping above (so it comes before us), but before all other extensions,
+ * so it doesn't confuse them. (particularly damage).
+ */
+ miInitializeCompositeWrapper(pScreen);
+#endif
+
+ return TRUE;
+}
+
+
+
+static Bool
+XAACloseScreen (int i, ScreenPtr pScreen)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ pScrn->EnterVT = pScreenPriv->EnterVT;
+ pScrn->LeaveVT = pScreenPriv->LeaveVT;
+ pScrn->EnableDisableFBAccess = pScreenPriv->EnableDisableFBAccess;
+
+ pScreen->CreateGC = pScreenPriv->CreateGC;
+ pScreen->CloseScreen = pScreenPriv->CloseScreen;
+ pScreen->GetImage = pScreenPriv->GetImage;
+ pScreen->GetSpans = pScreenPriv->GetSpans;
+ pScreen->CopyWindow = pScreenPriv->CopyWindow;
+ pScreen->WindowExposures = pScreenPriv->WindowExposures;
+ pScreen->CreatePixmap = pScreenPriv->CreatePixmap;
+ pScreen->DestroyPixmap = pScreenPriv->DestroyPixmap;
+ pScreen->ChangeWindowAttributes = pScreenPriv->ChangeWindowAttributes;
+
+ /* We leave it up to the client to free the XAAInfoRec */
+
+ free((pointer) pScreenPriv);
+
+ return (*pScreen->CloseScreen) (i, pScreen);
+}
+
+static void
+XAAGetImage (
+ DrawablePtr pDraw,
+ int sx, int sy, int w, int h,
+ unsigned int format,
+ unsigned long planemask,
+ char *pdstLine
+)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+
+ if(pScrn->vtSema &&
+ ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw)))
+ {
+ if(infoRec->ReadPixmap && (format == ZPixmap) &&
+ ((planemask & infoRec->FullPlanemasks[pDraw->depth - 1]) ==
+ infoRec->FullPlanemasks[pDraw->depth - 1]) &&
+ (pDraw->bitsPerPixel == BitsPerPixel(pDraw->depth)))
+ {
+ (*infoRec->ReadPixmap)(pScrn,
+ sx + pDraw->x, sy + pDraw->y, w, h,
+ (unsigned char *)pdstLine,
+ PixmapBytePad(w, pDraw->depth),
+ pDraw->bitsPerPixel, pDraw->depth);
+ return;
+ }
+ SYNC_CHECK(pDraw);
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, GetImage);
+ (*pScreen->GetImage) (pDraw, sx, sy, w, h, format, planemask, pdstLine);
+ XAA_SCREEN_EPILOGUE (pScreen, GetImage, XAAGetImage);
+}
+
+static void
+XAAGetSpans (
+ DrawablePtr pDraw,
+ int wMax,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ char *pdstStart
+)
+{
+ ScreenPtr pScreen = pDraw->pScreen;
+ XAA_SCREEN_PROLOGUE (pScreen, GetSpans);
+ if(xf86Screens[pScreen->myNum]->vtSema &&
+ ((pDraw->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pDraw))) {
+ SYNC_CHECK(pDraw);
+ }
+ (*pScreen->GetSpans) (pDraw, wMax, ppt, pwidth, nspans, pdstStart);
+ XAA_SCREEN_EPILOGUE (pScreen, GetSpans, XAAGetSpans);
+}
+
+
+static int
+XAAPixmapBPP (ScreenPtr pScreen, int depth)
+{
+ PixmapPtr pPix;
+ int bpp;
+ DestroyPixmapProcPtr destroyPixmap;
+
+ XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 1, 1, depth,
+ CREATE_PIXMAP_USAGE_SCRATCH);
+ XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
+ if (!pPix)
+ return 0;
+ bpp = pPix->drawable.bitsPerPixel;
+ destroyPixmap = pScreen->DestroyPixmap;
+ XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
+ (*pScreen->DestroyPixmap) (pPix);
+ XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, destroyPixmap);
+ return bpp;
+}
+
+static void
+XAAInitializeOffscreenDepths (ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ int d, dep;
+
+ infoRec->offscreenDepthsInitialized = TRUE;
+ infoRec->offscreenDepths = 0;
+ if (infoRec->Flags & OFFSCREEN_PIXMAPS) {
+ for (d = 0; d < pScreen->numDepths; d++) {
+ dep = pScreen->allowedDepths[d].depth;
+ if (XAAPixmapBPP (pScreen, dep) == pScrn->bitsPerPixel)
+ infoRec->offscreenDepths |= (1 << (dep - 1));
+ }
+ }
+}
+
+static PixmapPtr
+XAACreatePixmap(ScreenPtr pScreen, int w, int h, int depth, unsigned usage_hint)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAPixmapPtr pPriv;
+ PixmapPtr pPix = NULL;
+ int size = w * h;
+
+ if (w > 32767 || h > 32767)
+ return NullPixmap;
+
+ if (!infoRec->offscreenDepthsInitialized)
+ XAAInitializeOffscreenDepths (pScreen);
+
+ if(pScrn->vtSema &&
+ (usage_hint != CREATE_PIXMAP_USAGE_GLYPH_PICTURE) &&
+ (infoRec->offscreenDepths & (1 << (depth - 1))) &&
+ (size >= MIN_OFFPIX_SIZE) && !SwitchedOut &&
+ (!infoRec->maxOffPixWidth || (w <= infoRec->maxOffPixWidth)) &&
+ (!infoRec->maxOffPixHeight || (h <= infoRec->maxOffPixHeight)) )
+ {
+ PixmapLinkPtr pLink;
+ PixmapPtr pScreenPix;
+ FBAreaPtr area;
+ int gran = 0;
+
+ switch(pScrn->bitsPerPixel) {
+ case 24:
+ case 8: gran = 4; break;
+ case 16: gran = 2; break;
+ case 32: gran = 1; break;
+ default: break;
+ }
+
+ if(BITMAP_SCANLINE_PAD == 64)
+ gran *= 2;
+
+ if(!(area = xf86AllocateOffscreenArea(pScreen, w, h, gran, 0,
+ XAARemoveAreaCallback, NULL))) {
+ goto BAILOUT;
+ }
+
+ if(!(pLink = malloc(sizeof(PixmapLink)))) {
+ xf86FreeOffscreenArea(area);
+ goto BAILOUT;
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, 0, 0, depth, usage_hint);
+ XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
+
+ if (!pPix) {
+ free(pLink);
+ xf86FreeOffscreenArea(area);
+ goto BAILOUT;
+ }
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ pPix->drawable.x = area->box.x1;
+ pPix->drawable.y = area->box.y1;
+ pPix->drawable.width = w;
+ pPix->drawable.height = h;
+ pPix->drawable.bitsPerPixel = pScrn->bitsPerPixel;
+ pPix->devKind = pScreenPix->devKind;
+ pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
+ area->devPrivate.ptr = pPix;
+
+ pPriv->flags = OFFSCREEN;
+ pPriv->offscreenArea = area;
+ pPriv->freeData = FALSE;
+
+ pLink->next = infoRec->OffscreenPixmaps;
+ pLink->pPix = pPix;
+ infoRec->OffscreenPixmaps = pLink;
+ return pPix;
+ }
+BAILOUT:
+ XAA_SCREEN_PROLOGUE (pScreen, CreatePixmap);
+ pPix = (*pScreen->CreatePixmap) (pScreen, w, h, depth, usage_hint);
+ XAA_SCREEN_EPILOGUE (pScreen, CreatePixmap, XAACreatePixmap);
+
+ if(pPix) {
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ pPriv->flags = 0;
+ pPriv->offscreenArea = NULL;
+ pPriv->freeData = FALSE;
+ if(!w || !h) /* either scratch or shared memory */
+ pPriv->flags |= SHARED_PIXMAP;
+ }
+
+ return pPix;
+}
+
+static Bool
+XAADestroyPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ Bool ret;
+
+ if(pPix->refcnt == 1) {
+ if(pPriv->flags & OFFSCREEN) {
+ if(pPriv->flags & DGA_PIXMAP)
+ free(pPriv->offscreenArea);
+ else {
+ FBAreaPtr area = pPriv->offscreenArea;
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapLinkPtr prev = NULL;
+
+ while(pLink->pPix != pPix) {
+ prev = pLink;
+ pLink = pLink->next;
+ }
+
+ if(prev) prev->next = pLink->next;
+ else infoRec->OffscreenPixmaps = pLink->next;
+
+ if(!area) area = pLink->area;
+
+ xf86FreeOffscreenArea(area);
+ pPriv->offscreenArea = NULL;
+ free(pLink);
+ }
+ }
+
+ if(pPriv->freeData) { /* pixmaps that were once in video ram */
+ free(pPix->devPrivate.ptr);
+ pPix->devPrivate.ptr = NULL;
+ }
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, DestroyPixmap);
+ ret = (*pScreen->DestroyPixmap) (pPix);
+ XAA_SCREEN_EPILOGUE (pScreen, DestroyPixmap, XAADestroyPixmap);
+
+ return ret;
+}
+
+static Bool
+XAAChangeWindowAttributes (WindowPtr pWin, unsigned long mask)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ Bool ret;
+
+ XAA_SCREEN_PROLOGUE (pScreen, ChangeWindowAttributes);
+ ret = (*pScreen->ChangeWindowAttributes) (pWin, mask);
+ XAA_SCREEN_EPILOGUE (pScreen, ChangeWindowAttributes, XAAChangeWindowAttributes);
+
+ /* we have to assume that shared memory pixmaps are dirty
+ because we can't wrap operations on them */
+
+ if((mask & CWBackPixmap) && (pWin->backgroundState == BackgroundPixmap) &&
+ PIXMAP_IS_SHARED(pWin->background.pixmap))
+ {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->background.pixmap);
+ pPixPriv->flags |= DIRTY;
+ }
+ if((mask & CWBorderPixmap) && !(pWin->borderIsPixel) &&
+ PIXMAP_IS_SHARED(pWin->border.pixmap))
+ {
+ XAAPixmapPtr pPixPriv = XAA_GET_PIXMAP_PRIVATE(pWin->border.pixmap);
+ pPixPriv->flags |= DIRTY;
+ }
+
+ return ret;
+}
+
+
+
+/* These two aren't really needed for anything */
+
+static Bool
+XAAEnterVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ return((*pScreenPriv->EnterVT)(index, flags));
+}
+
+static void
+XAALeaveVT(int index, int flags)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+ XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
+
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+
+ (*pScreenPriv->LeaveVT)(index, flags);
+}
+
+typedef struct {
+ Bool UsingPixmapCache;
+ Bool CanDoColor8x8;
+ Bool CanDoMono8x8;
+} SavedCacheState, *SavedCacheStatePtr;
+
+static int
+XAASetDGAMode(int index, int num, DGADevicePtr devRet)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+ int ret;
+
+ if (!num && infoRec->dgaSaves) { /* restore old pixmap cache state */
+ SavedCacheStatePtr state = (SavedCacheStatePtr)infoRec->dgaSaves;
+
+ infoRec->UsingPixmapCache = state->UsingPixmapCache;
+ infoRec->CanDoColor8x8 = state->CanDoColor8x8;
+ infoRec->CanDoMono8x8 = state->CanDoMono8x8;
+ free(infoRec->dgaSaves);
+ infoRec->dgaSaves = NULL;
+ }
+
+ ret = (*pScreenPriv->SetDGAMode)(index, num, devRet);
+ if(ret != Success) return ret;
+
+ if(num && devRet->pPix) { /* accelerate this pixmap */
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(devRet->pPix);
+ FBAreaPtr area;
+
+ if((area = malloc(sizeof(FBArea)))) {
+ area->pScreen = pScreen;
+ area->box.x1 = 0;
+ area->box.x2 = 0;
+ area->box.y1 = devRet->mode->pixmapWidth;
+ area->box.y2 = devRet->mode->pixmapHeight;
+ area->granularity = 0;
+ area->MoveAreaCallback = 0;
+ area->RemoveAreaCallback = 0;
+ area->devPrivate.ptr = 0;
+
+ pixPriv->flags |= OFFSCREEN | DGA_PIXMAP;
+ pixPriv->offscreenArea = area;
+
+ if(!infoRec->dgaSaves) { /* save pixmap cache state */
+ SavedCacheStatePtr state = malloc(sizeof(SavedCacheState));
+
+ state->UsingPixmapCache = infoRec->UsingPixmapCache;
+ state->CanDoColor8x8 = infoRec->CanDoColor8x8;
+ state->CanDoMono8x8 = infoRec->CanDoMono8x8;
+ infoRec->dgaSaves = (char*)state;
+
+ infoRec->UsingPixmapCache = FALSE;
+ if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8)
+ infoRec->CanDoMono8x8 = FALSE;
+ if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8)
+ infoRec->CanDoColor8x8 = FALSE;
+ }
+ }
+ }
+
+ return ret;
+}
+
+
+
+static void
+XAAEnableDisableFBAccess (int index, Bool enable)
+{
+ ScreenPtr pScreen = screenInfo.screens[index];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAScreenPtr pScreenPriv =
+ (XAAScreenPtr)dixLookupPrivate(&pScreen->devPrivates, XAAScreenKey);
+
+ if(!enable) {
+ if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
+ XAAMoveOutOffscreenPixmaps(pScreen);
+ if(infoRec->Flags & PIXMAP_CACHE)
+ XAAInvalidatePixmapCache(pScreen);
+ SwitchedOut = TRUE;
+ }
+
+ (*pScreenPriv->EnableDisableFBAccess)(index, enable);
+
+ if(enable) {
+ if((infoRec->Flags & OFFSCREEN_PIXMAPS) && (infoRec->OffscreenPixmaps))
+ XAAMoveInOffscreenPixmaps(pScreen);
+ SwitchedOut = FALSE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
index 6f3d622e1..d24599d48 100644
--- a/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
+++ b/xorg-server/hw/xfree86/xaa/xaaInitAccel.c
@@ -1,1498 +1,1498 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-
-/*
- * XAA Config options
- */
-
-typedef enum {
- XAAOPT_SCREEN_TO_SCREEN_COPY,
- XAAOPT_SOLID_FILL_RECT,
- XAAOPT_SOLID_FILL_TRAP,
- XAAOPT_SOLID_TWO_POINT_LINE,
- XAAOPT_SOLID_BRESENHAM_LINE,
- XAAOPT_SOLID_HORVERT_LINE,
- XAAOPT_DASHED_TWO_POINT_LINE,
- XAAOPT_DASHED_BRESENHAM_LINE,
- XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
- XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
- XAAOPT_COL_8x8_PATTERN_FILL_RECT,
- XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
- XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
- XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
- XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
- XAAOPT_IMAGE_WRITE_RECT,
- XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
- XAAOPT_WRITE_BITMAP,
- XAAOPT_WRITE_PIXMAP,
- XAAOPT_PIXMAP_CACHE,
- XAAOPT_OFFSCREEN_PIXMAPS,
- XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE
-} XAAOpts;
-
-static const OptionInfoRec XAAOptions[] = {
- {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,"XaaNoScanlineCPUToScreenColorExpandFill",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps",
- OPTV_BOOLEAN, {0}, FALSE },
- {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps",
- OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL,
- OPTV_NONE, {0}, FALSE }
-};
-
-static XF86ModuleVersionInfo xaaVersRec =
-{
- "xaa",
- MODULEVENDORSTRING,
- MODINFOSTRING1,
- MODINFOSTRING2,
- XORG_VERSION_CURRENT,
- XAA_VERSION_MAJOR,
- XAA_VERSION_MINOR,
- XAA_VERSION_RELEASE,
- ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
- ABI_VIDEODRV_VERSION,
- MOD_CLASS_NONE,
- {0,0,0,0}
-};
-
-_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
-
-Bool
-XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
-{
- int index = pScreen->myNum;
- ScrnInfoPtr pScrn = xf86Screens[index];
- Bool HaveScreenToScreenCopy = FALSE;
- Bool HaveColorExpansion = FALSE;
- Bool HaveScanlineColorExpansion = FALSE;
- Bool HaveSolidFillRect = FALSE;
- Bool HaveMono8x8PatternFillRect = FALSE;
- Bool HaveColor8x8PatternFillRect = FALSE;
- Bool HaveSolidFillTrap = FALSE;
- Bool HaveMono8x8PatternFillTrap = FALSE;
- Bool HaveColor8x8PatternFillTrap = FALSE;
- Bool HaveSolidTwoPointLine = FALSE;
- Bool HaveSolidBresenhamLine = FALSE;
- Bool HaveSolidHorVertLine = FALSE;
- Bool HaveDashedTwoPointLine = FALSE;
- Bool HaveDashedBresenhamLine = FALSE;
- Bool HaveImageWriteRect = FALSE;
- Bool HaveScanlineImageWriteRect = FALSE;
- Bool HaveScreenToScreenColorExpandFill = FALSE;
- OptionInfoPtr options;
- int is_shared = 0;
- int i;
-
- options = xnfalloc(sizeof(XAAOptions));
- (void)memcpy(options, XAAOptions, sizeof(XAAOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- infoRec->pScrn = pScrn;
- infoRec->NeedToSync = FALSE;
-
- /* must have a Sync function */
- if(!infoRec->Sync) return FALSE;
- for(i = 0; i < pScrn->numEntities; i++) {
- if(xf86IsEntityShared(pScrn->entityList[i])) is_shared = 1;
- }
-
- /* If this PCI entity has IS_SHARED_ACCEL set in entityProp
- * then a RestoreAccelState function is required
- */
- if(!infoRec->RestoreAccelState && is_shared) return FALSE;
-
- if(infoRec->RestoreAccelState) {
- if(!XAAInitStateWrap(pScreen, infoRec)) return FALSE;
- }
-
- if (serverGeneration == 1)
- xf86DrvMsg(index, X_INFO,
- "Using XFree86 Acceleration Architecture (XAA)\n");
-
-
- /************** Low Level *************/
-
- if(!infoRec->SetClippingRectangle || !infoRec->DisableClipping) {
- infoRec->ClippingFlags = 0;
- infoRec->SetClippingRectangle = NULL;
- infoRec->DisableClipping = NULL;
- }
-
- /**** CopyArea ****/
-
- if(infoRec->SetupForScreenToScreenCopy &&
- infoRec->SubsequentScreenToScreenCopy &&
- !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
- HaveScreenToScreenCopy = TRUE;
- } else {
- infoRec->ScreenToScreenCopyFlags = 0;
- infoRec->SetupForScreenToScreenCopy = NULL;
- infoRec->SubsequentScreenToScreenCopy = NULL;
- }
-
- /**** Solid Filled Rects ****/
-
- if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
- !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
- HaveSolidFillRect = TRUE;
- if(infoRec->SubsequentSolidFillTrap &&
- !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
- HaveSolidFillTrap = TRUE;
- else
- infoRec->SubsequentSolidFillTrap = NULL;
- } else {
- infoRec->SolidFillFlags = 0;
- infoRec->SetupForSolidFill = NULL;
- infoRec->SubsequentSolidFillRect = NULL;
- infoRec->SubsequentSolidFillTrap = NULL;
- }
-
- /**** Solid lines ****/
-
- if(infoRec->SetupForSolidLine) {
- if(infoRec->SubsequentSolidTwoPointLine &&
- !xf86ReturnOptValBool(options,
- XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
- HaveSolidTwoPointLine = TRUE;
- if(infoRec->SubsequentSolidBresenhamLine &&
- !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) {
- HaveSolidBresenhamLine = TRUE;
-
- if(infoRec->SolidBresenhamLineErrorTermBits)
- infoRec->SolidBresenhamLineErrorTermBits =
- ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1);
- }
-
- if(infoRec->SubsequentSolidHorVertLine &&
- !xf86ReturnOptValBool(options,
- XAAOPT_SOLID_HORVERT_LINE, FALSE))
- HaveSolidHorVertLine = TRUE;
- else if(HaveSolidTwoPointLine) {
- infoRec->SubsequentSolidHorVertLine =
- XAASolidHorVertLineAsTwoPoint;
- HaveSolidHorVertLine = TRUE;
- } else if(HaveSolidBresenhamLine) {
- infoRec->SubsequentSolidHorVertLine =
- XAASolidHorVertLineAsBresenham;
- HaveSolidHorVertLine = TRUE;
- }
- }
-
- /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */
- if (!HaveSolidTwoPointLine &&
- !HaveSolidBresenhamLine &&
- !HaveSolidHorVertLine &&
- HaveSolidFillRect) {
- infoRec->SetupForSolidLine = infoRec->SetupForSolidFill;
- infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects;
- infoRec->SolidLineFlags = infoRec->SolidFillFlags;
- HaveSolidHorVertLine = TRUE;
- }
-
- if (!HaveSolidTwoPointLine)
- infoRec->SubsequentSolidTwoPointLine = NULL;
- if (!HaveSolidBresenhamLine)
- infoRec->SubsequentSolidBresenhamLine = NULL;
- if (!HaveSolidHorVertLine)
- infoRec->SubsequentSolidHorVertLine = NULL;
-
- /* Disable all if nothing left over */
- if (!HaveSolidTwoPointLine &&
- !HaveSolidBresenhamLine &&
- !HaveSolidHorVertLine) {
- infoRec->SolidLineFlags = 0;
- infoRec->SetupForSolidLine = NULL;
- }
-
- /**** 8x8 Mono Pattern Filled Rects ****/
-
- if(infoRec->SetupForMono8x8PatternFill &&
- infoRec->SubsequentMono8x8PatternFillRect &&
- !xf86ReturnOptValBool(options,
- XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
- FALSE)) {
- HaveMono8x8PatternFillRect = TRUE;
- if(infoRec->SubsequentMono8x8PatternFillTrap &&
- !xf86ReturnOptValBool(options,
- XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
- FALSE))
- HaveMono8x8PatternFillTrap = TRUE;
-
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_BITS) {
- infoRec->CanDoMono8x8 = TRUE;
- } else { /* others require caching */
- int min_pitch;
- infoRec->PixmapCacheFlags |= CACHE_MONO_8x8;
-
- switch(pScrn->bitsPerPixel) {
- case 32: min_pitch = 2; break;
- case 24: min_pitch = 3; break;
- case 16: min_pitch = 4; break;
- default: min_pitch = 8; break;
- }
-
- if(min_pitch > infoRec->MonoPatternPitch)
- infoRec->MonoPatternPitch = min_pitch;
-
- if(infoRec->Mono8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- if(!infoRec->CacheWidthMono8x8Pattern ||
- !infoRec->CacheHeightMono8x8Pattern) {
- infoRec->CacheWidthMono8x8Pattern =
- infoRec->MonoPatternPitch;
- infoRec->CacheHeightMono8x8Pattern = 1;
- }
- } else {
- int numPerLine = 128/infoRec->MonoPatternPitch;
-
- if(!infoRec->CacheWidthMono8x8Pattern ||
- !infoRec->CacheHeightMono8x8Pattern) {
- infoRec->CacheWidthMono8x8Pattern =
- numPerLine * infoRec->MonoPatternPitch;
- infoRec->CacheHeightMono8x8Pattern =
- (64 + numPerLine - 1)/numPerLine;
- }
- }
- }
- } else {
- infoRec->Mono8x8PatternFillFlags = 0;
- infoRec->SetupForMono8x8PatternFill = NULL;
- infoRec->SubsequentMono8x8PatternFillRect = NULL;
- }
-
- /**** Dashed lines ****/
-
- if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
- if(infoRec->SubsequentDashedTwoPointLine &&
- !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE,
- FALSE))
- HaveDashedTwoPointLine = TRUE;
- if(infoRec->SubsequentDashedBresenhamLine &&
- !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
- FALSE)) {
- HaveDashedBresenhamLine = TRUE;
-
- if(infoRec->DashedBresenhamLineErrorTermBits)
- infoRec->DashedBresenhamLineErrorTermBits =
- ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1);
- }
- }
-
- if (!HaveDashedTwoPointLine)
- infoRec->SubsequentDashedTwoPointLine = NULL;
- if (!HaveDashedBresenhamLine)
- infoRec->SubsequentDashedBresenhamLine = NULL;
-
- /* Disable all if nothing left over */
- if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) {
- infoRec->DashedLineFlags = 0;
- infoRec->SetupForDashedLine = NULL;
- }
-
- /**** 8x8 Color Pattern Filled Rects ****/
-
- if(infoRec->SetupForColor8x8PatternFill &&
- infoRec->SubsequentColor8x8PatternFillRect &&
- !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) {
- HaveColor8x8PatternFillRect = TRUE;
- if(infoRec->SubsequentColor8x8PatternFillTrap &&
- !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
- FALSE))
- HaveColor8x8PatternFillTrap = TRUE;
- else
- infoRec->SubsequentColor8x8PatternFillTrap = NULL;
-
- infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8;
-
- if(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- if(!infoRec->CacheWidthColor8x8Pattern ||
- !infoRec->CacheHeightColor8x8Pattern) {
- infoRec->CacheWidthColor8x8Pattern = 64;
- infoRec->CacheHeightColor8x8Pattern = 1;
- }
- } else {
- if(!infoRec->CacheWidthColor8x8Pattern ||
- !infoRec->CacheHeightColor8x8Pattern) {
- infoRec->CacheWidthColor8x8Pattern = 128;
- infoRec->CacheHeightColor8x8Pattern = 8;
- }
- }
- } else {
- infoRec->Color8x8PatternFillFlags = 0;
- infoRec->SetupForColor8x8PatternFill = NULL;
- infoRec->SubsequentColor8x8PatternFillRect = NULL;
- infoRec->SubsequentColor8x8PatternFillTrap = NULL;
- }
-
- /**** Color Expansion ****/
-
- if(infoRec->SetupForCPUToScreenColorExpandFill &&
- infoRec->ColorExpandBase &&
- infoRec->SubsequentCPUToScreenColorExpandFill &&
- !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
- FALSE)) {
- int dwordsNeeded = pScrn->virtualX;
-
- infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
- HaveColorExpansion = TRUE;
-
- if(infoRec->CPUToScreenColorExpandFillFlags &
- LEFT_EDGE_CLIPPING_NEGATIVE_X)
- dwordsNeeded += 31;
- dwordsNeeded = (dwordsNeeded + 31) >> 5;
- if(dwordsNeeded > infoRec->ColorExpandRange)
- infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED;
- } else {
- infoRec->CPUToScreenColorExpandFillFlags = 0;
- infoRec->SetupForCPUToScreenColorExpandFill = NULL;
- infoRec->SubsequentCPUToScreenColorExpandFill = NULL;
- }
-
- /**** Scanline Color Expansion ****/
-
- if(infoRec->SetupForScanlineCPUToScreenColorExpandFill &&
- infoRec->SubsequentScanlineCPUToScreenColorExpandFill &&
- infoRec->SubsequentColorExpandScanline &&
- infoRec->ScanlineColorExpandBuffers &&
- (infoRec->NumScanlineColorExpandBuffers > 0) &&
- !xf86ReturnOptValBool(options,
- XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
- FALSE)) {
- HaveScanlineColorExpansion = TRUE;
- } else {
- infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
- infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL;
- infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL;
- infoRec->SubsequentColorExpandScanline = NULL;
- }
-
- /**** Screen to Screen Color Expansion ****/
-
- if(infoRec->SetupForScreenToScreenColorExpandFill &&
- infoRec->SubsequentScreenToScreenColorExpandFill &&
- !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
- FALSE)) {
- HaveScreenToScreenColorExpandFill = TRUE;
- if (!infoRec->CacheColorExpandDensity)
- infoRec->CacheColorExpandDensity = 1;
- } else {
- infoRec->ScreenToScreenColorExpandFillFlags = 0;
- infoRec->SetupForScreenToScreenColorExpandFill = NULL;
- infoRec->SubsequentScreenToScreenColorExpandFill = NULL;
- }
-
- /**** Image Writes ****/
-
- if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
- infoRec->SubsequentImageWriteRect &&
- !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
-
- infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
- if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->ImageWriteRange = 0;
- HaveImageWriteRect = TRUE;
- } else {
- infoRec->ImageWriteFlags = 0;
- infoRec->SetupForImageWrite = NULL;
- infoRec->SubsequentImageWriteRect = NULL;
- }
-
- /**** Scanline Image Writes ****/
-
- if(infoRec->SetupForScanlineImageWrite &&
- infoRec->SubsequentScanlineImageWriteRect &&
- infoRec->SubsequentImageWriteScanline &&
- infoRec->ScanlineImageWriteBuffers &&
- (infoRec->NumScanlineImageWriteBuffers > 0) &&
- !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
- FALSE)) {
- HaveScanlineImageWriteRect = TRUE;
- } else {
- infoRec->ScanlineImageWriteFlags = 0;
- infoRec->SetupForScanlineImageWrite = NULL;
- infoRec->SubsequentScanlineImageWriteRect = NULL;
- infoRec->SubsequentImageWriteScanline = NULL;
- }
-
-#ifndef __i386__
- /* XAA makes some unaligned accesses when clipping is not available */
-# define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X)
- if(HaveImageWriteRect &&
- ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
- {
- HaveImageWriteRect = FALSE;
- }
- if(HaveScanlineImageWriteRect &&
- ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
- {
- HaveScanlineImageWriteRect = FALSE;
- }
-#endif
-
- if (serverGeneration == 1) {
- if(HaveScreenToScreenCopy)
- xf86ErrorF("\tScreen to screen bit blits\n");
- if(HaveSolidFillRect)
- xf86ErrorF("\tSolid filled rectangles\n");
- if(HaveSolidFillTrap)
- xf86ErrorF("\tSolid filled trapezoids\n");
- if(HaveMono8x8PatternFillRect)
- xf86ErrorF("\t8x8 mono pattern filled rectangles\n");
- if(HaveMono8x8PatternFillTrap)
- xf86ErrorF("\t8x8 mono pattern filled trapezoids\n");
- if(HaveColor8x8PatternFillRect)
- xf86ErrorF("\t8x8 color pattern filled rectangles\n");
- if(HaveColor8x8PatternFillTrap)
- xf86ErrorF("\t8x8 color pattern filled trapezoids\n");
-
- if(HaveColorExpansion)
- xf86ErrorF("\tCPU to Screen color expansion\n");
- else if(HaveScanlineColorExpansion)
- xf86ErrorF("\tIndirect CPU to Screen color expansion\n");
-
- if(HaveScreenToScreenColorExpandFill)
- xf86ErrorF("\tScreen to Screen color expansion\n");
-
- if(HaveSolidTwoPointLine || HaveSolidBresenhamLine)
- xf86ErrorF("\tSolid Lines\n");
- else if(HaveSolidHorVertLine)
- xf86ErrorF("\tSolid Horizontal and Vertical Lines\n");
-
- if(HaveDashedTwoPointLine || HaveDashedBresenhamLine)
- xf86ErrorF("\tDashed Lines\n");
-
- if(HaveImageWriteRect)
- xf86ErrorF("\tImage Writes\n");
- else if(HaveScanlineImageWriteRect)
- xf86ErrorF("\tScanline Image Writes\n");
-
- }
-
-#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
-
- if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
- xf86ReturnOptValBool(options,
- XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE,
- FALSE))
- {
- XAAMSG("\tOffscreen Pixmaps\n");
- } else {
- infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
- }
-
-
- /************** Mid Level *************/
-
- /**** ScreenToScreenBitBlt ****/
-
- if(infoRec->ScreenToScreenBitBlt) {
- XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n");
- } else if(HaveScreenToScreenCopy) {
- infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt;
- infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags;
- }
-
- /**** FillSolidRects ****/
-
- if(infoRec->FillSolidRects) {
- XAAMSG("\tDriver provided FillSolidRects replacement\n");
- } else if(HaveSolidFillRect) {
- infoRec->FillSolidRects = XAAFillSolidRects;
- infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags;
- }
-
- /**** FillSolidSpans ****/
-
- if(infoRec->FillSolidSpans) {
- XAAMSG("\tDriver provided FillSolidSpans replacement\n");
- } else if(HaveSolidFillRect) {
- infoRec->FillSolidSpans = XAAFillSolidSpans;
- infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags;
- }
-
- /**** FillMono8x8PatternRects ****/
-
- if(infoRec->FillMono8x8PatternRects) {
- XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n");
- } else if(HaveMono8x8PatternFillRect) {
- infoRec->FillMono8x8PatternRects =
- (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillMono8x8PatternRectsScreenOrigin :
- XAAFillMono8x8PatternRects;
-
- infoRec->FillMono8x8PatternRectsFlags =
- infoRec->Mono8x8PatternFillFlags;
- }
-
- /**** FillMono8x8PatternSpans ****/
-
- if(infoRec->FillMono8x8PatternSpans) {
- XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n");
- } else if(HaveMono8x8PatternFillRect) {
- infoRec->FillMono8x8PatternSpans =
- (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillMono8x8PatternSpansScreenOrigin:
- XAAFillMono8x8PatternSpans;
-
- infoRec->FillMono8x8PatternSpansFlags =
- infoRec->Mono8x8PatternFillFlags;
- }
-
- /**** FillColor8x8Rects ****/
-
- if(infoRec->FillColor8x8PatternRects) {
- XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n");
- } else if(HaveColor8x8PatternFillRect) {
- infoRec->FillColor8x8PatternRects =
- (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillColor8x8PatternRectsScreenOrigin :
- XAAFillColor8x8PatternRects;
-
- infoRec->FillColor8x8PatternRectsFlags =
- infoRec->Color8x8PatternFillFlags;
- }
-
- /**** FillColor8x8Spans ****/
-
- if(infoRec->FillColor8x8PatternSpans) {
- XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n");
- } else if(HaveColor8x8PatternFillRect) {
- infoRec->FillColor8x8PatternSpans =
- (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
- XAAFillColor8x8PatternSpansScreenOrigin:
- XAAFillColor8x8PatternSpans;
-
- infoRec->FillColor8x8PatternSpansFlags =
- infoRec->Color8x8PatternFillFlags;
- }
-
- /**** FillCacheBltRects ****/
-
- if(infoRec->FillCacheBltRects) {
- XAAMSG("\tDriver provided FillCacheBltRects replacement\n");
- } else if(HaveScreenToScreenCopy) {
- infoRec->FillCacheBltRects = XAAFillCacheBltRects;
- infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags;
- }
-
- /**** FillCacheBltSpans ****/
-
- if(infoRec->FillCacheBltSpans) {
- XAAMSG("\tDriver provided FillCacheBltSpans replacement\n");
- } else if(HaveScreenToScreenCopy) {
- infoRec->FillCacheBltSpans = XAAFillCacheBltSpans;
- infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags;
- }
-
- /**** FillCacheExpandRects ****/
-
- if(infoRec->FillCacheExpandRects) {
- XAAMSG("\tDriver provided FillCacheExpandRects replacement\n");
- } else if(HaveScreenToScreenColorExpandFill) {
- infoRec->FillCacheExpandRects = XAAFillCacheExpandRects;
- infoRec->FillCacheExpandRectsFlags =
- infoRec->ScreenToScreenColorExpandFillFlags;
- }
-
- /**** FillCacheExpandSpans ****/
-
- if(infoRec->FillCacheExpandSpans) {
- XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n");
- } else if(HaveScreenToScreenColorExpandFill) {
- infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans;
- infoRec->FillCacheExpandSpansFlags =
- infoRec->ScreenToScreenColorExpandFillFlags;
- }
-
- /**** FillColorExpandRects ****/
-
- if(infoRec->FillColorExpandRects) {
- XAAMSG("\tDriver provided FillColorExpandRects replacement\n");
- } else if(HaveColorExpansion) {
- if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3MSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3MSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3LSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRects3LSBFirst;
- }
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsMSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsMSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsLSBFirstFixedBase;
- else
- infoRec->FillColorExpandRects =
- XAAFillColorExpandRectsLSBFirst;
- }
- }
- infoRec->FillColorExpandRectsFlags =
- infoRec->CPUToScreenColorExpandFillFlags;
- } else if(HaveScanlineColorExpansion) {
- if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- TRIPLE_BITS_24BPP) {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRects3MSBFirst;
- else
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRects3LSBFirst;
- } else {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRectsMSBFirst;
- else
- infoRec->FillColorExpandRects =
- XAAFillScanlineColorExpandRectsLSBFirst;
- }
- infoRec->FillColorExpandRectsFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
- }
-
- /**** FillColorExpandSpans ****/
-
- if(infoRec->FillColorExpandSpans) {
- XAAMSG("\tDriver provided FillColorExpandSpans replacement\n");
- } else if(HaveColorExpansion) {
- if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3MSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3MSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3LSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpans3LSBFirst;
- }
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansMSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansMSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansLSBFirstFixedBase;
- else
- infoRec->FillColorExpandSpans =
- XAAFillColorExpandSpansLSBFirst;
- }
- }
- infoRec->FillColorExpandSpansFlags =
- infoRec->CPUToScreenColorExpandFillFlags;
- } else if(HaveScanlineColorExpansion) {
- if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- TRIPLE_BITS_24BPP) {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpans3MSBFirst;
- else
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpans3LSBFirst;
- } else {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpansMSBFirst;
- else
- infoRec->FillColorExpandSpans =
- XAAFillScanlineColorExpandSpansLSBFirst;
- }
- infoRec->FillColorExpandSpansFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
- }
-
- /**** FillImageWriteRects ****/
-
- if(infoRec->FillImageWriteRects) {
- XAAMSG("\tDriver provided FillImageWriteRects replacement\n");
- } else if(HaveImageWriteRect &&
- (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
- infoRec->FillImageWriteRects = XAAFillImageWriteRects;
- infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags;
- }
-
- /**** WriteBitmap ****/
-
- if(infoRec->WriteBitmap &&
- !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
- XAAMSG("\tDriver provided WriteBitmap replacement\n");
- } else if(HaveColorExpansion) {
- if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpand3MSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpand3LSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst;
- }
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST) {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpandMSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst;
- } else {
- if(infoRec->CPUToScreenColorExpandFillFlags &
- CPU_TRANSFER_BASE_FIXED)
- infoRec->WriteBitmap =
- XAAWriteBitmapColorExpandLSBFirstFixedBase;
- else
- infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst;
- }
- }
- infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags;
- } else if(HaveScanlineColorExpansion) {
- if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- TRIPLE_BITS_24BPP) {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpand3MSBFirst;
- else
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpand3LSBFirst;
- } else {
- if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpandMSBFirst;
- else
- infoRec->WriteBitmap =
- XAAWriteBitmapScanlineColorExpandLSBFirst;
- }
- infoRec->WriteBitmapFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
- } else
- infoRec->WriteBitmap = NULL;
-
- /**** TE Glyphs ****/
-
- if (infoRec->TEGlyphRenderer) {
- XAAMSG("\tDriver provided TEGlyphRenderer replacement\n");
- } else if (HaveColorExpansion) {
- infoRec->TEGlyphRendererFlags =
- infoRec->CPUToScreenColorExpandFillFlags;
-
- if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRenderer3MSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst;
- } else {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRenderer3LSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst;
- }
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
- infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
- XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
- " without solid fills\n");
- }
- } else {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRendererMSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst;
- } else {
- if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
- infoRec->TEGlyphRenderer =
- XAATEGlyphRendererLSBFirstFixedBase;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst;
- }
- }
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
- XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
- " without solid fills\n");
- }
-
- } else if (HaveScanlineColorExpansion) {
- infoRec->TEGlyphRendererFlags =
- infoRec->ScanlineCPUToScreenColorExpandFillFlags;
-
- if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst;
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
- infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
- XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
- " without solid fills\n");
- }
- } else {
- if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst;
- else
- infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst;
- }
-
- if (!HaveSolidFillRect &&
- (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
- XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
- " without solid fills\n");
- }
- }
-
- /**** NonTE Glyphs ****/
-
- if(infoRec->NonTEGlyphRenderer) {
- XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n");
- } else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
- infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer;
- infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags;
- }
-
- /**** WritePixmap ****/
-
- if(infoRec->WritePixmap &&
- !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
- XAAMSG("\tDriver provided WritePixmap replacement\n");
- } else if(HaveImageWriteRect) {
- infoRec->WritePixmap = XAAWritePixmap;
- infoRec->WritePixmapFlags =
- infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP;
- } else if(HaveScanlineImageWriteRect) {
- infoRec->WritePixmap = XAAWritePixmapScanline;
- infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags;
- } else
- infoRec->WritePixmap = NULL;
-
- /**** ReadPixmap ****/
-
- if(infoRec->ReadPixmap) {
- XAAMSG("\tDriver provided ReadPixmap replacement\n");
- }
-
-
- /************** GC Level *************/
-
- /**** CopyArea ****/
-
- if(infoRec->CopyArea) {
- XAAMSG("\tDriver provided GC level CopyArea replacement\n");
- } else if(infoRec->ScreenToScreenBitBlt) {
- infoRec->CopyArea = XAACopyArea;
- infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags;
-
- /* most GC level primitives use one mid-level primitive so
- the GC level primitive gets the mid-level primitive flag
- and we use that at GC validation time. But CopyArea uses
- more than one mid-level primitive so we have to essentially
- do a GC validation every time that primitive is used.
- The CopyAreaFlags would only be used for filtering out the
- common denominators. Here we assume that if you don't do
- ScreenToScreenBitBlt you aren't going to do the others.
- We also assume that ScreenToScreenBitBlt has the least
- restrictions. */
- }
-
- if(infoRec->CopyPlane) {
- XAAMSG("\tDriver provided GC level CopyPlane replacement\n");
- } else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) {
- infoRec->CopyPlane = XAACopyPlaneColorExpansion;
- infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags;
- }
-
- if(infoRec->PushPixelsSolid) {
- XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n");
- } else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
- infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion;
- infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags;
- }
-
- if(infoRec->FillSolidRects) {
- if(!infoRec->PolyFillRectSolid) {
- infoRec->PolyFillRectSolid = XAAPolyFillRect;
- infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags;
- }
- }
- if(infoRec->FillSolidSpans) {
- if(!infoRec->FillSpansSolid) {
- infoRec->FillSpansSolid = XAAFillSpans;
- infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags;
- }
- }
-
- if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
- infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
- infoRec->FillCacheExpandRects) {
- if(!infoRec->PolyFillRectStippled) {
-
- infoRec->PolyFillRectStippled = XAAPolyFillRect;
- infoRec->PolyFillRectStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
- infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
- infoRec->FillCacheExpandSpans) {
- if(!infoRec->FillSpansStippled) {
-
- infoRec->FillSpansStippled = XAAFillSpans;
- infoRec->FillSpansStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
- infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
- infoRec->FillCacheExpandRects) {
- if(!infoRec->PolyFillRectOpaqueStippled) {
-
- infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect;
- infoRec->PolyFillRectOpaqueStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
- infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
- infoRec->FillCacheExpandSpans) {
- if(!infoRec->FillSpansOpaqueStippled) {
-
- infoRec->FillSpansOpaqueStippled = XAAFillSpans;
- infoRec->FillSpansOpaqueStippledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
- infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) {
- if(!infoRec->PolyFillRectTiled) {
-
- infoRec->PolyFillRectTiled = XAAPolyFillRect;
- infoRec->PolyFillRectTiledFlags = 0;
- }
- }
-
- if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
- infoRec->FillCacheBltSpans) {
- if(!infoRec->FillSpansTiled) {
-
- infoRec->FillSpansTiled = XAAFillSpans;
- infoRec->FillSpansTiledFlags = 0;
- }
- }
-
- if(infoRec->TEGlyphRenderer &&
- !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) {
-
- if(!infoRec->PolyText8TE) {
- infoRec->PolyText8TE = XAAPolyText8TEColorExpansion;
- infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->PolyText16TE) {
- infoRec->PolyText16TE = XAAPolyText16TEColorExpansion;
- infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->PolyGlyphBltTE) {
- infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion;
- infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
- }
- }
-
- if(infoRec->TEGlyphRenderer &&
- !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
-
- if(!infoRec->ImageText8TE) {
- infoRec->ImageText8TE = XAAImageText8TEColorExpansion;
- infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageText16TE) {
- infoRec->ImageText16TE = XAAImageText16TEColorExpansion;
- infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageGlyphBltTE) {
- infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion;
- infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
- }
- }
-
- if(infoRec->NonTEGlyphRenderer) {
- if(!infoRec->PolyText8NonTE) {
- infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion;
- infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
-
- if(!infoRec->PolyText16NonTE) {
- infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion;
- infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
- if(!infoRec->PolyGlyphBltNonTE) {
- infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion;
- infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
- }
-
- if(infoRec->NonTEGlyphRenderer && HaveSolidFillRect) {
- if(!infoRec->ImageText8NonTE) {
- infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion;
- infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageText16NonTE) {
- infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion;
- infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
-
- if(!infoRec->ImageGlyphBltNonTE) {
- infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion;
- infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
- }
- }
-
- if(!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) {
- infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid;
- infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags;
- }
-
- if(!infoRec->FillPolygonSolid && HaveSolidFillRect) {
- infoRec->FillPolygonSolid = XAAFillPolygonSolid;
- infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect ||
- HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
- infoRec->FillPolygonStippled = XAAFillPolygonStippled;
- infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect ||
- HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
- infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled;
- infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect ||
- HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
- infoRec->FillPolygonTiled = XAAFillPolygonTiled;
- infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags;
- }
-
-
- if(!infoRec->PolyFillArcSolid && HaveSolidFillRect) {
- infoRec->PolyFillArcSolid = XAAPolyFillArcSolid;
- infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags;
- }
-
- if(!infoRec->PolylinesWideSolid && HaveSolidFillRect) {
- infoRec->PolylinesWideSolid = XAAPolylinesWideSolid;
- infoRec->PolylinesWideSolidFlags =
- infoRec->SolidFillFlags | GXCOPY_ONLY;
- }
-
- if(!infoRec->PutImage && (infoRec->WritePixmap ||
- (infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)))) {
- infoRec->PutImage = XAAPutImage;
-
- /* See comment for CopyArea above. But here we make fewer
- assumptions. The driver can provide the PutImageFlags if
- it wants too */
- }
-
- if(HaveSolidHorVertLine &&
- (HaveSolidBresenhamLine || (HaveSolidTwoPointLine &&
- (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE)))){
- if(!infoRec->PolylinesThinSolid) {
- infoRec->PolylinesThinSolid = XAAPolyLines;
- infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags;
- }
- if(!infoRec->PolySegmentThinSolid) {
- infoRec->PolySegmentThinSolid = XAAPolySegment;
- infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags;
- }
- }
-
- if(HaveDashedBresenhamLine || (HaveDashedTwoPointLine &&
- (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE))){
- if(!infoRec->PolylinesThinDashed) {
- infoRec->PolylinesThinDashed = XAAPolyLinesDashed;
- infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags;
- }
- if(!infoRec->PolySegmentThinDashed) {
- infoRec->PolySegmentThinDashed = XAAPolySegmentDashed;
- infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags;
- }
- }
-
- if(infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) {
- if(!infoRec->ComputeDash)
- infoRec->ComputeDash = XAAComputeDash;
- }
-
- {
- Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
- infoRec->CPUToScreenTextureDstFormats &&
- infoRec->SetupForCPUToScreenTexture2 &&
- infoRec->SubsequentCPUToScreenTexture;
- Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats &&
- infoRec->CPUToScreenAlphaTextureDstFormats &&
- infoRec->SetupForCPUToScreenAlphaTexture2 &&
- infoRec->SubsequentCPUToScreenAlphaTexture;
-
- if(!infoRec->Composite && (haveTexture || haveAlphaTexture))
- infoRec->Composite = XAADoComposite;
-
- if(!infoRec->Glyphs && infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY))
- {
- infoRec->Glyphs = XAADoGlyphs;
- }
- }
-
- /************ Validation Functions **************/
-
- if(!infoRec->ValidateCopyArea && infoRec->CopyArea) {
- infoRec->CopyAreaMask = GCWhenForced;
- if((infoRec->CopyAreaFlags & GXCOPY_ONLY) ||
- (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE))
- infoRec->CopyAreaMask |= GCFunction;
- if(infoRec->CopyAreaFlags & NO_PLANEMASK)
- infoRec->CopyAreaMask |= GCPlaneMask;
- infoRec->ValidateCopyArea = XAAValidateCopyArea;
- }
-
- if(!infoRec->ValidateCopyPlane && infoRec->CopyPlane) {
- infoRec->CopyPlaneMask = GCWhenForced;
- if((infoRec->CopyPlaneFlags & GXCOPY_ONLY) ||
- (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE))
- infoRec->CopyPlaneMask |= GCFunction;
- if(infoRec->CopyPlaneFlags & NO_PLANEMASK)
- infoRec->CopyPlaneMask |= GCPlaneMask;
- if(infoRec->CopyPlaneFlags & RGB_EQUAL)
- infoRec->CopyPlaneMask |= GCForeground | GCBackground;
- infoRec->ValidateCopyPlane = XAAValidateCopyPlane;
- }
-
- if(!infoRec->ValidatePutImage && infoRec->PutImage) {
- infoRec->PutImageMask = GCWhenForced;
- if((infoRec->PutImageFlags & GXCOPY_ONLY) ||
- (infoRec->PutImageFlags & ROP_NEEDS_SOURCE))
- infoRec->PutImageMask |= GCFunction;
- if(infoRec->PutImageFlags & NO_PLANEMASK)
- infoRec->PutImageMask |= GCPlaneMask;
- if(infoRec->PutImageFlags & RGB_EQUAL)
- infoRec->PutImageMask |= GCForeground | GCBackground;
- infoRec->ValidatePutImage = XAAValidatePutImage;
- }
-
-
- if(!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) {
- infoRec->PushPixelsMask = GCFillStyle;
- if((infoRec->PushPixelsFlags & GXCOPY_ONLY) ||
- (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) ||
- (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY))
- infoRec->PushPixelsMask |= GCFunction;
- if(infoRec->PushPixelsFlags & NO_PLANEMASK)
- infoRec->PushPixelsMask |= GCPlaneMask;
- if(infoRec->PushPixelsFlags & RGB_EQUAL)
- infoRec->PushPixelsMask |= GCForeground;
- infoRec->ValidatePushPixels = XAAValidatePushPixels;
- }
-
- /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon
- and PolyFillArcs have the same restrictions. If you supply GC
- level replacements for any of these and alter this relationship
- you may need to supply replacement validation routines */
-
- if(!infoRec->ValidateFillSpans &&
- (infoRec->FillSpansSolid || infoRec->FillSpansStippled ||
- infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) {
-
- int compositeFlags = infoRec->FillSpansSolidFlags |
- infoRec->FillSpansStippledFlags |
- infoRec->FillSpansOpaqueStippledFlags |
- infoRec->FillSpansTiledFlags;
-
- infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple;
-
- if((compositeFlags & GXCOPY_ONLY) ||
- (compositeFlags & ROP_NEEDS_SOURCE))
- infoRec->FillSpansMask |= GCFunction;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->FillSpansMask |= GCPlaneMask;
- if(compositeFlags & RGB_EQUAL)
- infoRec->FillSpansMask |= GCForeground;
- infoRec->ValidateFillSpans = XAAValidateFillSpans;
- }
-
- /* By default XAA only provides Validations for the GlyphBlt
- functions and not the text higher up. This is because the
- Text8/16 and GlyphBlt are linked. If you break this linkage,
- you may need to have the driver supply its own Validation
- routines */
-
- if(!infoRec->ValidatePolyGlyphBlt &&
- (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) {
- int compositeFlags = infoRec->PolyGlyphBltTEFlags |
- infoRec->PolyGlyphBltNonTEFlags;
-
- infoRec->PolyGlyphBltMask = GCFillStyle | GCFont;
- if((compositeFlags & GXCOPY_ONLY) ||
- (compositeFlags & ROP_NEEDS_SOURCE) ||
- (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY))
- infoRec->PolyGlyphBltMask |= GCFunction;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->PolyGlyphBltMask |= GCPlaneMask;
- if(compositeFlags & RGB_EQUAL)
- infoRec->PolyGlyphBltMask |= GCForeground;
- infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt;
- }
-
- if(!infoRec->ValidateImageGlyphBlt &&
- (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) {
- int compositeFlags = infoRec->ImageGlyphBltTEFlags |
- infoRec->ImageGlyphBltNonTEFlags;
-
- if(infoRec->ImageGlyphBltNonTE)
- compositeFlags |= infoRec->SolidFillFlags;
-
- infoRec->ImageGlyphBltMask = GCFont;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->ImageGlyphBltMask |= GCPlaneMask;
- if(compositeFlags & RGB_EQUAL)
- infoRec->ImageGlyphBltMask |= GCForeground | GCBackground;
- infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt;
- }
-
- /* By default XAA only provides a Validation function for the
- Polylines and does segments and polylines at the same time */
-
- if(!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) {
- int compositeFlags = infoRec->PolyRectangleThinSolidFlags |
- infoRec->PolylinesWideSolidFlags |
- infoRec->PolylinesThinSolidFlags |
- infoRec->PolySegmentThinSolidFlags |
- infoRec->PolySegmentThinDashedFlags |
- infoRec->PolylinesThinDashedFlags;
-
- infoRec->ValidatePolylines = XAAValidatePolylines;
- infoRec->PolylinesMask =
- infoRec->FillSpansMask | GCLineStyle | GCLineWidth;
-
- if(infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed)
- infoRec->PolylinesMask |= GCDashList;
- if(compositeFlags & NO_PLANEMASK)
- infoRec->PolylinesMask |= GCPlaneMask;
- if((compositeFlags & GXCOPY_ONLY) ||
- (compositeFlags & ROP_NEEDS_SOURCE))
- infoRec->PolylinesMask |= GCFunction;
- if(compositeFlags & RGB_EQUAL)
- infoRec->PolylinesMask |= GCForeground;
- }
-
-
- /**** Fill choosers ****/
-
- if(!infoRec->StippledFillChooser)
- infoRec->StippledFillChooser = XAAStippledFillChooser;
-
- if(!infoRec->OpaqueStippledFillChooser)
- infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser;
-
- if(!infoRec->TiledFillChooser)
- infoRec->TiledFillChooser = XAATiledFillChooser;
-
-
- /**** Setup the pixmap cache ****/
-
- if(infoRec->WriteBitmapToCache) {}
- else if(infoRec->WriteBitmap &&
- !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))
- infoRec->WriteBitmapToCache = XAAWriteBitmapToCache;
- else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
- infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear;
- else
- infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
-
- if(infoRec->WritePixmapToCache) {}
- else if(infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY))
- infoRec->WritePixmapToCache = XAAWritePixmapToCache;
- else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
- infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear;
- else
- infoRec->Flags &= ~PIXMAP_CACHE;
-
- if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
- infoRec->Flags &= ~PIXMAP_CACHE;
-
- if(infoRec->WriteMono8x8PatternToCache) {}
- else if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8) {
- if(infoRec->WritePixmapToCache)
- infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache;
- else
- infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8;
- }
-
- if(infoRec->WriteColor8x8PatternToCache) {}
- else if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) {
- if(infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache)
- infoRec->WriteColor8x8PatternToCache = XAAWriteColor8x8PatternToCache;
- else
- infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8;
- }
-
- if(infoRec->CachePixelGranularity < 0) {
- switch(pScrn->bitsPerPixel) {
- case 24:
- case 8: infoRec->CachePixelGranularity = 4; break;
- case 16: infoRec->CachePixelGranularity = 2; break;
- case 32: infoRec->CachePixelGranularity = 1; break;
- default: break;
- }
-
- if(BITMAP_SCANLINE_PAD == 64)
- infoRec->CachePixelGranularity *= 2;
- }
-
- xfree(options);
-
- if(!infoRec->CacheTile && infoRec->WritePixmapToCache)
- infoRec->CacheTile = XAACacheTile;
- if(!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache)
- infoRec->CacheMonoStipple = XAACacheMonoStipple;
- if(!infoRec->CacheStipple && infoRec->WriteBitmapToCache)
- infoRec->CacheStipple = XAACacheStipple;
- if(!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache)
- infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern;
- if(!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache)
- infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern;
-
- if((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) {
- infoRec->InitPixmapCache = XAAInitPixmapCache;
- infoRec->ClosePixmapCache = XAAClosePixmapCache;
- }
-
- return TRUE;
-}
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+/*
+ * XAA Config options
+ */
+
+typedef enum {
+ XAAOPT_SCREEN_TO_SCREEN_COPY,
+ XAAOPT_SOLID_FILL_RECT,
+ XAAOPT_SOLID_FILL_TRAP,
+ XAAOPT_SOLID_TWO_POINT_LINE,
+ XAAOPT_SOLID_BRESENHAM_LINE,
+ XAAOPT_SOLID_HORVERT_LINE,
+ XAAOPT_DASHED_TWO_POINT_LINE,
+ XAAOPT_DASHED_BRESENHAM_LINE,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+ XAAOPT_COL_8x8_PATTERN_FILL_RECT,
+ XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ XAAOPT_IMAGE_WRITE_RECT,
+ XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ XAAOPT_WRITE_BITMAP,
+ XAAOPT_WRITE_PIXMAP,
+ XAAOPT_PIXMAP_CACHE,
+ XAAOPT_OFFSCREEN_PIXMAPS,
+ XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE
+} XAAOpts;
+
+static const OptionInfoRec XAAOptions[] = {
+ {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_FILL_TRAP, "XaaNoSolidFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_TWO_POINT_LINE, "XaaNoSolidTwoPointLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_BRESENHAM_LINE, "XaaNoSolidBresenhamLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SOLID_HORVERT_LINE, "XaaNoSolidHorVertLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_DASHED_TWO_POINT_LINE, "XaaNoDashedTwoPointLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_DASHED_BRESENHAM_LINE, "XaaNoDashedBresenhamLine",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_MONO_8x8_PATTERN_FILL_RECT, "XaaNoMono8x8PatternFillRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_MONO_8x8_PATTERN_FILL_TRAP, "XaaNoMono8x8PatternFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_COL_8x8_PATTERN_FILL_RECT, "XaaNoColor8x8PatternFillRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_COL_8x8_PATTERN_FILL_TRAP, "XaaNoColor8x8PatternFillTrap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL, "XaaNoCPUToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,"XaaNoScanlineCPUToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, "XaaNoScreenToScreenColorExpandFill",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_IMAGE_WRITE_RECT, "XaaNoImageWriteRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps",
+ OPTV_BOOLEAN, {0}, FALSE },
+ {XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE, "XaaOffscreenPixmaps",
+ OPTV_BOOLEAN, {0}, FALSE },
+ { -1, NULL,
+ OPTV_NONE, {0}, FALSE }
+};
+
+static XF86ModuleVersionInfo xaaVersRec =
+{
+ "xaa",
+ MODULEVENDORSTRING,
+ MODINFOSTRING1,
+ MODINFOSTRING2,
+ XORG_VERSION_CURRENT,
+ XAA_VERSION_MAJOR,
+ XAA_VERSION_MINOR,
+ XAA_VERSION_RELEASE,
+ ABI_CLASS_VIDEODRV, /* requires the video driver ABI */
+ ABI_VIDEODRV_VERSION,
+ MOD_CLASS_NONE,
+ {0,0,0,0}
+};
+
+_X_EXPORT XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL };
+
+Bool
+XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ int index = pScreen->myNum;
+ ScrnInfoPtr pScrn = xf86Screens[index];
+ Bool HaveScreenToScreenCopy = FALSE;
+ Bool HaveColorExpansion = FALSE;
+ Bool HaveScanlineColorExpansion = FALSE;
+ Bool HaveSolidFillRect = FALSE;
+ Bool HaveMono8x8PatternFillRect = FALSE;
+ Bool HaveColor8x8PatternFillRect = FALSE;
+ Bool HaveSolidFillTrap = FALSE;
+ Bool HaveMono8x8PatternFillTrap = FALSE;
+ Bool HaveColor8x8PatternFillTrap = FALSE;
+ Bool HaveSolidTwoPointLine = FALSE;
+ Bool HaveSolidBresenhamLine = FALSE;
+ Bool HaveSolidHorVertLine = FALSE;
+ Bool HaveDashedTwoPointLine = FALSE;
+ Bool HaveDashedBresenhamLine = FALSE;
+ Bool HaveImageWriteRect = FALSE;
+ Bool HaveScanlineImageWriteRect = FALSE;
+ Bool HaveScreenToScreenColorExpandFill = FALSE;
+ OptionInfoPtr options;
+ int is_shared = 0;
+ int i;
+
+ options = xnfalloc(sizeof(XAAOptions));
+ (void)memcpy(options, XAAOptions, sizeof(XAAOptions));
+ xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
+
+ infoRec->pScrn = pScrn;
+ infoRec->NeedToSync = FALSE;
+
+ /* must have a Sync function */
+ if(!infoRec->Sync) return FALSE;
+ for(i = 0; i < pScrn->numEntities; i++) {
+ if(xf86IsEntityShared(pScrn->entityList[i])) is_shared = 1;
+ }
+
+ /* If this PCI entity has IS_SHARED_ACCEL set in entityProp
+ * then a RestoreAccelState function is required
+ */
+ if(!infoRec->RestoreAccelState && is_shared) return FALSE;
+
+ if(infoRec->RestoreAccelState) {
+ if(!XAAInitStateWrap(pScreen, infoRec)) return FALSE;
+ }
+
+ if (serverGeneration == 1)
+ xf86DrvMsg(index, X_INFO,
+ "Using XFree86 Acceleration Architecture (XAA)\n");
+
+
+ /************** Low Level *************/
+
+ if(!infoRec->SetClippingRectangle || !infoRec->DisableClipping) {
+ infoRec->ClippingFlags = 0;
+ infoRec->SetClippingRectangle = NULL;
+ infoRec->DisableClipping = NULL;
+ }
+
+ /**** CopyArea ****/
+
+ if(infoRec->SetupForScreenToScreenCopy &&
+ infoRec->SubsequentScreenToScreenCopy &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COPY, FALSE)) {
+ HaveScreenToScreenCopy = TRUE;
+ } else {
+ infoRec->ScreenToScreenCopyFlags = 0;
+ infoRec->SetupForScreenToScreenCopy = NULL;
+ infoRec->SubsequentScreenToScreenCopy = NULL;
+ }
+
+ /**** Solid Filled Rects ****/
+
+ if(infoRec->SetupForSolidFill && infoRec->SubsequentSolidFillRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_RECT, FALSE)) {
+ HaveSolidFillRect = TRUE;
+ if(infoRec->SubsequentSolidFillTrap &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_FILL_TRAP, FALSE))
+ HaveSolidFillTrap = TRUE;
+ else
+ infoRec->SubsequentSolidFillTrap = NULL;
+ } else {
+ infoRec->SolidFillFlags = 0;
+ infoRec->SetupForSolidFill = NULL;
+ infoRec->SubsequentSolidFillRect = NULL;
+ infoRec->SubsequentSolidFillTrap = NULL;
+ }
+
+ /**** Solid lines ****/
+
+ if(infoRec->SetupForSolidLine) {
+ if(infoRec->SubsequentSolidTwoPointLine &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SOLID_TWO_POINT_LINE, FALSE))
+ HaveSolidTwoPointLine = TRUE;
+ if(infoRec->SubsequentSolidBresenhamLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_SOLID_BRESENHAM_LINE, FALSE)) {
+ HaveSolidBresenhamLine = TRUE;
+
+ if(infoRec->SolidBresenhamLineErrorTermBits)
+ infoRec->SolidBresenhamLineErrorTermBits =
+ ~((1 << infoRec->SolidBresenhamLineErrorTermBits) - 1);
+ }
+
+ if(infoRec->SubsequentSolidHorVertLine &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SOLID_HORVERT_LINE, FALSE))
+ HaveSolidHorVertLine = TRUE;
+ else if(HaveSolidTwoPointLine) {
+ infoRec->SubsequentSolidHorVertLine =
+ XAASolidHorVertLineAsTwoPoint;
+ HaveSolidHorVertLine = TRUE;
+ } else if(HaveSolidBresenhamLine) {
+ infoRec->SubsequentSolidHorVertLine =
+ XAASolidHorVertLineAsBresenham;
+ HaveSolidHorVertLine = TRUE;
+ }
+ }
+
+ /* XXX Should this also check for XAAOPT_SOLID_HORVERT_LINE? */
+ if (!HaveSolidTwoPointLine &&
+ !HaveSolidBresenhamLine &&
+ !HaveSolidHorVertLine &&
+ HaveSolidFillRect) {
+ infoRec->SetupForSolidLine = infoRec->SetupForSolidFill;
+ infoRec->SubsequentSolidHorVertLine = XAASolidHorVertLineAsRects;
+ infoRec->SolidLineFlags = infoRec->SolidFillFlags;
+ HaveSolidHorVertLine = TRUE;
+ }
+
+ if (!HaveSolidTwoPointLine)
+ infoRec->SubsequentSolidTwoPointLine = NULL;
+ if (!HaveSolidBresenhamLine)
+ infoRec->SubsequentSolidBresenhamLine = NULL;
+ if (!HaveSolidHorVertLine)
+ infoRec->SubsequentSolidHorVertLine = NULL;
+
+ /* Disable all if nothing left over */
+ if (!HaveSolidTwoPointLine &&
+ !HaveSolidBresenhamLine &&
+ !HaveSolidHorVertLine) {
+ infoRec->SolidLineFlags = 0;
+ infoRec->SetupForSolidLine = NULL;
+ }
+
+ /**** 8x8 Mono Pattern Filled Rects ****/
+
+ if(infoRec->SetupForMono8x8PatternFill &&
+ infoRec->SubsequentMono8x8PatternFillRect &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_RECT,
+ FALSE)) {
+ HaveMono8x8PatternFillRect = TRUE;
+ if(infoRec->SubsequentMono8x8PatternFillTrap &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_MONO_8x8_PATTERN_FILL_TRAP,
+ FALSE))
+ HaveMono8x8PatternFillTrap = TRUE;
+
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_BITS) {
+ infoRec->CanDoMono8x8 = TRUE;
+ } else { /* others require caching */
+ int min_pitch;
+ infoRec->PixmapCacheFlags |= CACHE_MONO_8x8;
+
+ switch(pScrn->bitsPerPixel) {
+ case 32: min_pitch = 2; break;
+ case 24: min_pitch = 3; break;
+ case 16: min_pitch = 4; break;
+ default: min_pitch = 8; break;
+ }
+
+ if(min_pitch > infoRec->MonoPatternPitch)
+ infoRec->MonoPatternPitch = min_pitch;
+
+ if(infoRec->Mono8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ if(!infoRec->CacheWidthMono8x8Pattern ||
+ !infoRec->CacheHeightMono8x8Pattern) {
+ infoRec->CacheWidthMono8x8Pattern =
+ infoRec->MonoPatternPitch;
+ infoRec->CacheHeightMono8x8Pattern = 1;
+ }
+ } else {
+ int numPerLine = 128/infoRec->MonoPatternPitch;
+
+ if(!infoRec->CacheWidthMono8x8Pattern ||
+ !infoRec->CacheHeightMono8x8Pattern) {
+ infoRec->CacheWidthMono8x8Pattern =
+ numPerLine * infoRec->MonoPatternPitch;
+ infoRec->CacheHeightMono8x8Pattern =
+ (64 + numPerLine - 1)/numPerLine;
+ }
+ }
+ }
+ } else {
+ infoRec->Mono8x8PatternFillFlags = 0;
+ infoRec->SetupForMono8x8PatternFill = NULL;
+ infoRec->SubsequentMono8x8PatternFillRect = NULL;
+ }
+
+ /**** Dashed lines ****/
+
+ if(infoRec->SetupForDashedLine && infoRec->DashPatternMaxLength) {
+ if(infoRec->SubsequentDashedTwoPointLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_TWO_POINT_LINE,
+ FALSE))
+ HaveDashedTwoPointLine = TRUE;
+ if(infoRec->SubsequentDashedBresenhamLine &&
+ !xf86ReturnOptValBool(options, XAAOPT_DASHED_BRESENHAM_LINE,
+ FALSE)) {
+ HaveDashedBresenhamLine = TRUE;
+
+ if(infoRec->DashedBresenhamLineErrorTermBits)
+ infoRec->DashedBresenhamLineErrorTermBits =
+ ~((1 << infoRec->DashedBresenhamLineErrorTermBits) - 1);
+ }
+ }
+
+ if (!HaveDashedTwoPointLine)
+ infoRec->SubsequentDashedTwoPointLine = NULL;
+ if (!HaveDashedBresenhamLine)
+ infoRec->SubsequentDashedBresenhamLine = NULL;
+
+ /* Disable all if nothing left over */
+ if (!HaveDashedTwoPointLine && !HaveDashedBresenhamLine) {
+ infoRec->DashedLineFlags = 0;
+ infoRec->SetupForDashedLine = NULL;
+ }
+
+ /**** 8x8 Color Pattern Filled Rects ****/
+
+ if(infoRec->SetupForColor8x8PatternFill &&
+ infoRec->SubsequentColor8x8PatternFillRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_RECT, FALSE)) {
+ HaveColor8x8PatternFillRect = TRUE;
+ if(infoRec->SubsequentColor8x8PatternFillTrap &&
+ !xf86ReturnOptValBool(options, XAAOPT_COL_8x8_PATTERN_FILL_TRAP,
+ FALSE))
+ HaveColor8x8PatternFillTrap = TRUE;
+ else
+ infoRec->SubsequentColor8x8PatternFillTrap = NULL;
+
+ infoRec->PixmapCacheFlags |= CACHE_COLOR_8x8;
+
+ if(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ if(!infoRec->CacheWidthColor8x8Pattern ||
+ !infoRec->CacheHeightColor8x8Pattern) {
+ infoRec->CacheWidthColor8x8Pattern = 64;
+ infoRec->CacheHeightColor8x8Pattern = 1;
+ }
+ } else {
+ if(!infoRec->CacheWidthColor8x8Pattern ||
+ !infoRec->CacheHeightColor8x8Pattern) {
+ infoRec->CacheWidthColor8x8Pattern = 128;
+ infoRec->CacheHeightColor8x8Pattern = 8;
+ }
+ }
+ } else {
+ infoRec->Color8x8PatternFillFlags = 0;
+ infoRec->SetupForColor8x8PatternFill = NULL;
+ infoRec->SubsequentColor8x8PatternFillRect = NULL;
+ infoRec->SubsequentColor8x8PatternFillTrap = NULL;
+ }
+
+ /**** Color Expansion ****/
+
+ if(infoRec->SetupForCPUToScreenColorExpandFill &&
+ infoRec->ColorExpandBase &&
+ infoRec->SubsequentCPUToScreenColorExpandFill &&
+ !xf86ReturnOptValBool(options, XAAOPT_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ int dwordsNeeded = pScrn->virtualX;
+
+ infoRec->ColorExpandRange >>= 2; /* convert to DWORDS */
+ HaveColorExpansion = TRUE;
+
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ LEFT_EDGE_CLIPPING_NEGATIVE_X)
+ dwordsNeeded += 31;
+ dwordsNeeded = (dwordsNeeded + 31) >> 5;
+ if(dwordsNeeded > infoRec->ColorExpandRange)
+ infoRec->CPUToScreenColorExpandFillFlags |= CPU_TRANSFER_BASE_FIXED;
+ } else {
+ infoRec->CPUToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentCPUToScreenColorExpandFill = NULL;
+ }
+
+ /**** Scanline Color Expansion ****/
+
+ if(infoRec->SetupForScanlineCPUToScreenColorExpandFill &&
+ infoRec->SubsequentScanlineCPUToScreenColorExpandFill &&
+ infoRec->SubsequentColorExpandScanline &&
+ infoRec->ScanlineColorExpandBuffers &&
+ (infoRec->NumScanlineColorExpandBuffers > 0) &&
+ !xf86ReturnOptValBool(options,
+ XAAOPT_SCANLINE_CPU_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ HaveScanlineColorExpansion = TRUE;
+ } else {
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForScanlineCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentScanlineCPUToScreenColorExpandFill = NULL;
+ infoRec->SubsequentColorExpandScanline = NULL;
+ }
+
+ /**** Screen to Screen Color Expansion ****/
+
+ if(infoRec->SetupForScreenToScreenColorExpandFill &&
+ infoRec->SubsequentScreenToScreenColorExpandFill &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL,
+ FALSE)) {
+ HaveScreenToScreenColorExpandFill = TRUE;
+ if (!infoRec->CacheColorExpandDensity)
+ infoRec->CacheColorExpandDensity = 1;
+ } else {
+ infoRec->ScreenToScreenColorExpandFillFlags = 0;
+ infoRec->SetupForScreenToScreenColorExpandFill = NULL;
+ infoRec->SubsequentScreenToScreenColorExpandFill = NULL;
+ }
+
+ /**** Image Writes ****/
+
+ if(infoRec->SetupForImageWrite && infoRec->ImageWriteBase &&
+ infoRec->SubsequentImageWriteRect &&
+ !xf86ReturnOptValBool(options, XAAOPT_IMAGE_WRITE_RECT, FALSE)) {
+
+ infoRec->ImageWriteRange >>= 2; /* convert to DWORDS */
+ if(infoRec->ImageWriteFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->ImageWriteRange = 0;
+ HaveImageWriteRect = TRUE;
+ } else {
+ infoRec->ImageWriteFlags = 0;
+ infoRec->SetupForImageWrite = NULL;
+ infoRec->SubsequentImageWriteRect = NULL;
+ }
+
+ /**** Scanline Image Writes ****/
+
+ if(infoRec->SetupForScanlineImageWrite &&
+ infoRec->SubsequentScanlineImageWriteRect &&
+ infoRec->SubsequentImageWriteScanline &&
+ infoRec->ScanlineImageWriteBuffers &&
+ (infoRec->NumScanlineImageWriteBuffers > 0) &&
+ !xf86ReturnOptValBool(options, XAAOPT_SCANLINE_IMAGE_WRITE_RECT,
+ FALSE)) {
+ HaveScanlineImageWriteRect = TRUE;
+ } else {
+ infoRec->ScanlineImageWriteFlags = 0;
+ infoRec->SetupForScanlineImageWrite = NULL;
+ infoRec->SubsequentScanlineImageWriteRect = NULL;
+ infoRec->SubsequentImageWriteScanline = NULL;
+ }
+
+#ifndef __i386__
+ /* XAA makes some unaligned accesses when clipping is not available */
+# define CLIP_FLAGS (LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X)
+ if(HaveImageWriteRect &&
+ ((infoRec->ImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
+ {
+ HaveImageWriteRect = FALSE;
+ }
+ if(HaveScanlineImageWriteRect &&
+ ((infoRec->ScanlineImageWriteFlags & CLIP_FLAGS) != CLIP_FLAGS))
+ {
+ HaveScanlineImageWriteRect = FALSE;
+ }
+#endif
+
+ if (serverGeneration == 1) {
+ if(HaveScreenToScreenCopy)
+ xf86ErrorF("\tScreen to screen bit blits\n");
+ if(HaveSolidFillRect)
+ xf86ErrorF("\tSolid filled rectangles\n");
+ if(HaveSolidFillTrap)
+ xf86ErrorF("\tSolid filled trapezoids\n");
+ if(HaveMono8x8PatternFillRect)
+ xf86ErrorF("\t8x8 mono pattern filled rectangles\n");
+ if(HaveMono8x8PatternFillTrap)
+ xf86ErrorF("\t8x8 mono pattern filled trapezoids\n");
+ if(HaveColor8x8PatternFillRect)
+ xf86ErrorF("\t8x8 color pattern filled rectangles\n");
+ if(HaveColor8x8PatternFillTrap)
+ xf86ErrorF("\t8x8 color pattern filled trapezoids\n");
+
+ if(HaveColorExpansion)
+ xf86ErrorF("\tCPU to Screen color expansion\n");
+ else if(HaveScanlineColorExpansion)
+ xf86ErrorF("\tIndirect CPU to Screen color expansion\n");
+
+ if(HaveScreenToScreenColorExpandFill)
+ xf86ErrorF("\tScreen to Screen color expansion\n");
+
+ if(HaveSolidTwoPointLine || HaveSolidBresenhamLine)
+ xf86ErrorF("\tSolid Lines\n");
+ else if(HaveSolidHorVertLine)
+ xf86ErrorF("\tSolid Horizontal and Vertical Lines\n");
+
+ if(HaveDashedTwoPointLine || HaveDashedBresenhamLine)
+ xf86ErrorF("\tDashed Lines\n");
+
+ if(HaveImageWriteRect)
+ xf86ErrorF("\tImage Writes\n");
+ else if(HaveScanlineImageWriteRect)
+ xf86ErrorF("\tScanline Image Writes\n");
+
+ }
+
+#define XAAMSG(s) do { if (serverGeneration == 1) xf86ErrorF(s); } while (0)
+
+ if((infoRec->Flags & OFFSCREEN_PIXMAPS) && HaveScreenToScreenCopy &&
+ xf86ReturnOptValBool(options,
+ XAAOPT_HAS_DUMB_INVERTED_OPTION_SENSE,
+ FALSE))
+ {
+ XAAMSG("\tOffscreen Pixmaps\n");
+ } else {
+ infoRec->Flags &= ~OFFSCREEN_PIXMAPS;
+ }
+
+
+ /************** Mid Level *************/
+
+ /**** ScreenToScreenBitBlt ****/
+
+ if(infoRec->ScreenToScreenBitBlt) {
+ XAAMSG("\tDriver provided ScreenToScreenBitBlt replacement\n");
+ } else if(HaveScreenToScreenCopy) {
+ infoRec->ScreenToScreenBitBlt = XAAScreenToScreenBitBlt;
+ infoRec->ScreenToScreenBitBltFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillSolidRects ****/
+
+ if(infoRec->FillSolidRects) {
+ XAAMSG("\tDriver provided FillSolidRects replacement\n");
+ } else if(HaveSolidFillRect) {
+ infoRec->FillSolidRects = XAAFillSolidRects;
+ infoRec->FillSolidRectsFlags = infoRec->SolidFillFlags;
+ }
+
+ /**** FillSolidSpans ****/
+
+ if(infoRec->FillSolidSpans) {
+ XAAMSG("\tDriver provided FillSolidSpans replacement\n");
+ } else if(HaveSolidFillRect) {
+ infoRec->FillSolidSpans = XAAFillSolidSpans;
+ infoRec->FillSolidSpansFlags = infoRec->SolidFillFlags;
+ }
+
+ /**** FillMono8x8PatternRects ****/
+
+ if(infoRec->FillMono8x8PatternRects) {
+ XAAMSG("\tDriver provided FillMono8x8PatternRects replacement\n");
+ } else if(HaveMono8x8PatternFillRect) {
+ infoRec->FillMono8x8PatternRects =
+ (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillMono8x8PatternRectsScreenOrigin :
+ XAAFillMono8x8PatternRects;
+
+ infoRec->FillMono8x8PatternRectsFlags =
+ infoRec->Mono8x8PatternFillFlags;
+ }
+
+ /**** FillMono8x8PatternSpans ****/
+
+ if(infoRec->FillMono8x8PatternSpans) {
+ XAAMSG("\tDriver provided FillMono8x8PatternSpans replacement\n");
+ } else if(HaveMono8x8PatternFillRect) {
+ infoRec->FillMono8x8PatternSpans =
+ (infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillMono8x8PatternSpansScreenOrigin:
+ XAAFillMono8x8PatternSpans;
+
+ infoRec->FillMono8x8PatternSpansFlags =
+ infoRec->Mono8x8PatternFillFlags;
+ }
+
+ /**** FillColor8x8Rects ****/
+
+ if(infoRec->FillColor8x8PatternRects) {
+ XAAMSG("\tDriver provided FillColor8x8PatternRects replacement\n");
+ } else if(HaveColor8x8PatternFillRect) {
+ infoRec->FillColor8x8PatternRects =
+ (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillColor8x8PatternRectsScreenOrigin :
+ XAAFillColor8x8PatternRects;
+
+ infoRec->FillColor8x8PatternRectsFlags =
+ infoRec->Color8x8PatternFillFlags;
+ }
+
+ /**** FillColor8x8Spans ****/
+
+ if(infoRec->FillColor8x8PatternSpans) {
+ XAAMSG("\tDriver provided FillColor8x8PatternSpans replacement\n");
+ } else if(HaveColor8x8PatternFillRect) {
+ infoRec->FillColor8x8PatternSpans =
+ (infoRec->Color8x8PatternFillFlags & HARDWARE_PATTERN_SCREEN_ORIGIN) ?
+ XAAFillColor8x8PatternSpansScreenOrigin:
+ XAAFillColor8x8PatternSpans;
+
+ infoRec->FillColor8x8PatternSpansFlags =
+ infoRec->Color8x8PatternFillFlags;
+ }
+
+ /**** FillCacheBltRects ****/
+
+ if(infoRec->FillCacheBltRects) {
+ XAAMSG("\tDriver provided FillCacheBltRects replacement\n");
+ } else if(HaveScreenToScreenCopy) {
+ infoRec->FillCacheBltRects = XAAFillCacheBltRects;
+ infoRec->FillCacheBltRectsFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillCacheBltSpans ****/
+
+ if(infoRec->FillCacheBltSpans) {
+ XAAMSG("\tDriver provided FillCacheBltSpans replacement\n");
+ } else if(HaveScreenToScreenCopy) {
+ infoRec->FillCacheBltSpans = XAAFillCacheBltSpans;
+ infoRec->FillCacheBltSpansFlags = infoRec->ScreenToScreenCopyFlags;
+ }
+
+ /**** FillCacheExpandRects ****/
+
+ if(infoRec->FillCacheExpandRects) {
+ XAAMSG("\tDriver provided FillCacheExpandRects replacement\n");
+ } else if(HaveScreenToScreenColorExpandFill) {
+ infoRec->FillCacheExpandRects = XAAFillCacheExpandRects;
+ infoRec->FillCacheExpandRectsFlags =
+ infoRec->ScreenToScreenColorExpandFillFlags;
+ }
+
+ /**** FillCacheExpandSpans ****/
+
+ if(infoRec->FillCacheExpandSpans) {
+ XAAMSG("\tDriver provided FillCacheExpandSpans replacement\n");
+ } else if(HaveScreenToScreenColorExpandFill) {
+ infoRec->FillCacheExpandSpans = XAAFillCacheExpandSpans;
+ infoRec->FillCacheExpandSpansFlags =
+ infoRec->ScreenToScreenColorExpandFillFlags;
+ }
+
+ /**** FillColorExpandRects ****/
+
+ if(infoRec->FillColorExpandRects) {
+ XAAMSG("\tDriver provided FillColorExpandRects replacement\n");
+ } else if(HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3MSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3MSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3LSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRects3LSBFirst;
+ }
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsMSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsMSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsLSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillColorExpandRectsLSBFirst;
+ }
+ }
+ infoRec->FillColorExpandRectsFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+ } else if(HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRects3MSBFirst;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRects3LSBFirst;
+ } else {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRectsMSBFirst;
+ else
+ infoRec->FillColorExpandRects =
+ XAAFillScanlineColorExpandRectsLSBFirst;
+ }
+ infoRec->FillColorExpandRectsFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+
+ /**** FillColorExpandSpans ****/
+
+ if(infoRec->FillColorExpandSpans) {
+ XAAMSG("\tDriver provided FillColorExpandSpans replacement\n");
+ } else if(HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3MSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3MSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3LSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpans3LSBFirst;
+ }
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansMSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansMSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansLSBFirstFixedBase;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillColorExpandSpansLSBFirst;
+ }
+ }
+ infoRec->FillColorExpandSpansFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+ } else if(HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpans3MSBFirst;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpans3LSBFirst;
+ } else {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpansMSBFirst;
+ else
+ infoRec->FillColorExpandSpans =
+ XAAFillScanlineColorExpandSpansLSBFirst;
+ }
+ infoRec->FillColorExpandSpansFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ }
+
+ /**** FillImageWriteRects ****/
+
+ if(infoRec->FillImageWriteRects) {
+ XAAMSG("\tDriver provided FillImageWriteRects replacement\n");
+ } else if(HaveImageWriteRect &&
+ (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (infoRec->ImageWriteFlags & LEFT_EDGE_CLIPPING)) {
+ infoRec->FillImageWriteRects = XAAFillImageWriteRects;
+ infoRec->FillImageWriteRectsFlags = infoRec->ImageWriteFlags;
+ }
+
+ /**** WriteBitmap ****/
+
+ if(infoRec->WriteBitmap &&
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_BITMAP, FALSE)) {
+ XAAMSG("\tDriver provided WriteBitmap replacement\n");
+ } else if(HaveColorExpansion) {
+ if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpand3MSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpand3MSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpand3LSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpand3LSBFirst;
+ }
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpandMSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpandMSBFirst;
+ } else {
+ if(infoRec->CPUToScreenColorExpandFillFlags &
+ CPU_TRANSFER_BASE_FIXED)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapColorExpandLSBFirstFixedBase;
+ else
+ infoRec->WriteBitmap = XAAWriteBitmapColorExpandLSBFirst;
+ }
+ }
+ infoRec->WriteBitmapFlags = infoRec->CPUToScreenColorExpandFillFlags;
+ } else if(HaveScanlineColorExpansion) {
+ if (infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ TRIPLE_BITS_24BPP) {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpand3MSBFirst;
+ else
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpand3LSBFirst;
+ } else {
+ if(infoRec->ScanlineCPUToScreenColorExpandFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpandMSBFirst;
+ else
+ infoRec->WriteBitmap =
+ XAAWriteBitmapScanlineColorExpandLSBFirst;
+ }
+ infoRec->WriteBitmapFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+ } else
+ infoRec->WriteBitmap = NULL;
+
+ /**** TE Glyphs ****/
+
+ if (infoRec->TEGlyphRenderer) {
+ XAAMSG("\tDriver provided TEGlyphRenderer replacement\n");
+ } else if (HaveColorExpansion) {
+ infoRec->TEGlyphRendererFlags =
+ infoRec->CPUToScreenColorExpandFillFlags;
+
+ if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRenderer3MSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRenderer3MSBFirst;
+ } else {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRenderer3LSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRenderer3LSBFirst;
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
+ infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
+ " without solid fills\n");
+ }
+ } else {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRendererMSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererMSBFirst;
+ } else {
+ if (infoRec->TEGlyphRendererFlags & CPU_TRANSFER_BASE_FIXED)
+ infoRec->TEGlyphRenderer =
+ XAATEGlyphRendererLSBFirstFixedBase;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererLSBFirst;
+ }
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
+ " without solid fills\n");
+ }
+
+ } else if (HaveScanlineColorExpansion) {
+ infoRec->TEGlyphRendererFlags =
+ infoRec->ScanlineCPUToScreenColorExpandFillFlags;
+
+ if (infoRec->TEGlyphRendererFlags & TRIPLE_BITS_24BPP) {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3MSBFirst;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanline3LSBFirst;
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & RGB_EQUAL)) {
+ infoRec->TEGlyphRendererFlags &= ~RGB_EQUAL;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support RGB_EQUAL"
+ " without solid fills\n");
+ }
+ } else {
+ if (infoRec->TEGlyphRendererFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineMSBFirst;
+ else
+ infoRec->TEGlyphRenderer = XAATEGlyphRendererScanlineLSBFirst;
+ }
+
+ if (!HaveSolidFillRect &&
+ (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ infoRec->TEGlyphRendererFlags &= ~TRANSPARENCY_ONLY;
+ XAAMSG("WARNING: TEGlyphRenderer cannot support TRANPARENCY_ONLY"
+ " without solid fills\n");
+ }
+ }
+
+ /**** NonTE Glyphs ****/
+
+ if(infoRec->NonTEGlyphRenderer) {
+ XAAMSG("\tDriver provided NonTEGlyphRenderer replacement\n");
+ } else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->NonTEGlyphRenderer = XAANonTEGlyphRenderer;
+ infoRec->NonTEGlyphRendererFlags = infoRec->WriteBitmapFlags;
+ }
+
+ /**** WritePixmap ****/
+
+ if(infoRec->WritePixmap &&
+ !xf86ReturnOptValBool(options, XAAOPT_WRITE_PIXMAP, FALSE)) {
+ XAAMSG("\tDriver provided WritePixmap replacement\n");
+ } else if(HaveImageWriteRect) {
+ infoRec->WritePixmap = XAAWritePixmap;
+ infoRec->WritePixmapFlags =
+ infoRec->ImageWriteFlags | CONVERT_32BPP_TO_24BPP;
+ } else if(HaveScanlineImageWriteRect) {
+ infoRec->WritePixmap = XAAWritePixmapScanline;
+ infoRec->WritePixmapFlags = infoRec->ScanlineImageWriteFlags;
+ } else
+ infoRec->WritePixmap = NULL;
+
+ /**** ReadPixmap ****/
+
+ if(infoRec->ReadPixmap) {
+ XAAMSG("\tDriver provided ReadPixmap replacement\n");
+ }
+
+
+ /************** GC Level *************/
+
+ /**** CopyArea ****/
+
+ if(infoRec->CopyArea) {
+ XAAMSG("\tDriver provided GC level CopyArea replacement\n");
+ } else if(infoRec->ScreenToScreenBitBlt) {
+ infoRec->CopyArea = XAACopyArea;
+ infoRec->CopyAreaFlags = infoRec->ScreenToScreenBitBltFlags;
+
+ /* most GC level primitives use one mid-level primitive so
+ the GC level primitive gets the mid-level primitive flag
+ and we use that at GC validation time. But CopyArea uses
+ more than one mid-level primitive so we have to essentially
+ do a GC validation every time that primitive is used.
+ The CopyAreaFlags would only be used for filtering out the
+ common denominators. Here we assume that if you don't do
+ ScreenToScreenBitBlt you aren't going to do the others.
+ We also assume that ScreenToScreenBitBlt has the least
+ restrictions. */
+ }
+
+ if(infoRec->CopyPlane) {
+ XAAMSG("\tDriver provided GC level CopyPlane replacement\n");
+ } else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)) {
+ infoRec->CopyPlane = XAACopyPlaneColorExpansion;
+ infoRec->CopyPlaneFlags = infoRec->WriteBitmapFlags;
+ }
+
+ if(infoRec->PushPixelsSolid) {
+ XAAMSG("\tDriver provided GC level PushPixelsSolid replacement\n");
+ } else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) {
+ infoRec->PushPixelsSolid = XAAPushPixelsSolidColorExpansion;
+ infoRec->PushPixelsFlags = infoRec->WriteBitmapFlags;
+ }
+
+ if(infoRec->FillSolidRects) {
+ if(!infoRec->PolyFillRectSolid) {
+ infoRec->PolyFillRectSolid = XAAPolyFillRect;
+ infoRec->PolyFillRectSolidFlags = infoRec->FillSolidRectsFlags;
+ }
+ }
+ if(infoRec->FillSolidSpans) {
+ if(!infoRec->FillSpansSolid) {
+ infoRec->FillSpansSolid = XAAFillSpans;
+ infoRec->FillSpansSolidFlags = infoRec->FillSolidSpansFlags;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
+ infoRec->FillCacheExpandRects) {
+ if(!infoRec->PolyFillRectStippled) {
+
+ infoRec->PolyFillRectStippled = XAAPolyFillRect;
+ infoRec->PolyFillRectStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
+ infoRec->FillCacheExpandSpans) {
+ if(!infoRec->FillSpansStippled) {
+
+ infoRec->FillSpansStippled = XAAFillSpans;
+ infoRec->FillSpansStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillColorExpandRects ||
+ infoRec->FillCacheExpandRects) {
+ if(!infoRec->PolyFillRectOpaqueStippled) {
+
+ infoRec->PolyFillRectOpaqueStippled = XAAPolyFillRect;
+ infoRec->PolyFillRectOpaqueStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans || infoRec->FillColorExpandSpans ||
+ infoRec->FillCacheExpandSpans) {
+ if(!infoRec->FillSpansOpaqueStippled) {
+
+ infoRec->FillSpansOpaqueStippled = XAAFillSpans;
+ infoRec->FillSpansOpaqueStippledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternRects || infoRec->FillColor8x8PatternRects ||
+ infoRec->FillCacheBltRects || infoRec->FillImageWriteRects) {
+ if(!infoRec->PolyFillRectTiled) {
+
+ infoRec->PolyFillRectTiled = XAAPolyFillRect;
+ infoRec->PolyFillRectTiledFlags = 0;
+ }
+ }
+
+ if(infoRec->FillMono8x8PatternSpans || infoRec->FillColor8x8PatternSpans ||
+ infoRec->FillCacheBltSpans) {
+ if(!infoRec->FillSpansTiled) {
+
+ infoRec->FillSpansTiled = XAAFillSpans;
+ infoRec->FillSpansTiledFlags = 0;
+ }
+ }
+
+ if(infoRec->TEGlyphRenderer &&
+ !(infoRec->TEGlyphRendererFlags & NO_TRANSPARENCY)) {
+
+ if(!infoRec->PolyText8TE) {
+ infoRec->PolyText8TE = XAAPolyText8TEColorExpansion;
+ infoRec->PolyText8TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->PolyText16TE) {
+ infoRec->PolyText16TE = XAAPolyText16TEColorExpansion;
+ infoRec->PolyText16TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->PolyGlyphBltTE) {
+ infoRec->PolyGlyphBltTE = XAAPolyGlyphBltTEColorExpansion;
+ infoRec->PolyGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
+ }
+ }
+
+ if(infoRec->TEGlyphRenderer &&
+ !(infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+
+ if(!infoRec->ImageText8TE) {
+ infoRec->ImageText8TE = XAAImageText8TEColorExpansion;
+ infoRec->ImageText8TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageText16TE) {
+ infoRec->ImageText16TE = XAAImageText16TEColorExpansion;
+ infoRec->ImageText16TEFlags = infoRec->TEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageGlyphBltTE) {
+ infoRec->ImageGlyphBltTE = XAAImageGlyphBltTEColorExpansion;
+ infoRec->ImageGlyphBltTEFlags = infoRec->TEGlyphRendererFlags;
+ }
+ }
+
+ if(infoRec->NonTEGlyphRenderer) {
+ if(!infoRec->PolyText8NonTE) {
+ infoRec->PolyText8NonTE = XAAPolyText8NonTEColorExpansion;
+ infoRec->PolyText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if(!infoRec->PolyText16NonTE) {
+ infoRec->PolyText16NonTE = XAAPolyText16NonTEColorExpansion;
+ infoRec->PolyText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ if(!infoRec->PolyGlyphBltNonTE) {
+ infoRec->PolyGlyphBltNonTE = XAAPolyGlyphBltNonTEColorExpansion;
+ infoRec->PolyGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ }
+
+ if(infoRec->NonTEGlyphRenderer && HaveSolidFillRect) {
+ if(!infoRec->ImageText8NonTE) {
+ infoRec->ImageText8NonTE = XAAImageText8NonTEColorExpansion;
+ infoRec->ImageText8NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageText16NonTE) {
+ infoRec->ImageText16NonTE = XAAImageText16NonTEColorExpansion;
+ infoRec->ImageText16NonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+
+ if(!infoRec->ImageGlyphBltNonTE) {
+ infoRec->ImageGlyphBltNonTE = XAAImageGlyphBltNonTEColorExpansion;
+ infoRec->ImageGlyphBltNonTEFlags = infoRec->NonTEGlyphRendererFlags;
+ }
+ }
+
+ if(!infoRec->PolyRectangleThinSolid && HaveSolidHorVertLine) {
+ infoRec->PolyRectangleThinSolid = XAAPolyRectangleThinSolid;
+ infoRec->PolyRectangleThinSolidFlags = infoRec->SolidLineFlags;
+ }
+
+ if(!infoRec->FillPolygonSolid && HaveSolidFillRect) {
+ infoRec->FillPolygonSolid = XAAFillPolygonSolid;
+ infoRec->FillPolygonSolidFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->FillPolygonStippled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonStippled = XAAFillPolygonStippled;
+ infoRec->FillPolygonStippledFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->FillPolygonOpaqueStippled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonOpaqueStippled = XAAFillPolygonStippled;
+ infoRec->FillPolygonOpaqueStippledFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->FillPolygonTiled && (HaveMono8x8PatternFillRect ||
+ HaveScreenToScreenColorExpandFill || HaveScreenToScreenCopy)) {
+ infoRec->FillPolygonTiled = XAAFillPolygonTiled;
+ infoRec->FillPolygonTiledFlags = infoRec->SolidFillFlags;
+ }
+
+
+ if(!infoRec->PolyFillArcSolid && HaveSolidFillRect) {
+ infoRec->PolyFillArcSolid = XAAPolyFillArcSolid;
+ infoRec->PolyFillArcSolidFlags = infoRec->SolidFillFlags;
+ }
+
+ if(!infoRec->PolylinesWideSolid && HaveSolidFillRect) {
+ infoRec->PolylinesWideSolid = XAAPolylinesWideSolid;
+ infoRec->PolylinesWideSolidFlags =
+ infoRec->SolidFillFlags | GXCOPY_ONLY;
+ }
+
+ if(!infoRec->PutImage && (infoRec->WritePixmap ||
+ (infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY)))) {
+ infoRec->PutImage = XAAPutImage;
+
+ /* See comment for CopyArea above. But here we make fewer
+ assumptions. The driver can provide the PutImageFlags if
+ it wants too */
+ }
+
+ if(HaveSolidHorVertLine &&
+ (HaveSolidBresenhamLine || (HaveSolidTwoPointLine &&
+ (infoRec->ClippingFlags & HARDWARE_CLIP_SOLID_LINE)))){
+ if(!infoRec->PolylinesThinSolid) {
+ infoRec->PolylinesThinSolid = XAAPolyLines;
+ infoRec->PolylinesThinSolidFlags = infoRec->SolidLineFlags;
+ }
+ if(!infoRec->PolySegmentThinSolid) {
+ infoRec->PolySegmentThinSolid = XAAPolySegment;
+ infoRec->PolySegmentThinSolidFlags = infoRec->SolidLineFlags;
+ }
+ }
+
+ if(HaveDashedBresenhamLine || (HaveDashedTwoPointLine &&
+ (infoRec->ClippingFlags & HARDWARE_CLIP_DASHED_LINE))){
+ if(!infoRec->PolylinesThinDashed) {
+ infoRec->PolylinesThinDashed = XAAPolyLinesDashed;
+ infoRec->PolylinesThinDashedFlags = infoRec->DashedLineFlags;
+ }
+ if(!infoRec->PolySegmentThinDashed) {
+ infoRec->PolySegmentThinDashed = XAAPolySegmentDashed;
+ infoRec->PolySegmentThinDashedFlags = infoRec->DashedLineFlags;
+ }
+ }
+
+ if(infoRec->PolylinesThinDashed || infoRec->PolySegmentThinDashed) {
+ if(!infoRec->ComputeDash)
+ infoRec->ComputeDash = XAAComputeDash;
+ }
+
+ {
+ Bool haveTexture = infoRec->CPUToScreenTextureFormats &&
+ infoRec->CPUToScreenTextureDstFormats &&
+ infoRec->SetupForCPUToScreenTexture2 &&
+ infoRec->SubsequentCPUToScreenTexture;
+ Bool haveAlphaTexture = infoRec->CPUToScreenAlphaTextureFormats &&
+ infoRec->CPUToScreenAlphaTextureDstFormats &&
+ infoRec->SetupForCPUToScreenAlphaTexture2 &&
+ infoRec->SubsequentCPUToScreenAlphaTexture;
+
+ if(!infoRec->Composite && (haveTexture || haveAlphaTexture))
+ infoRec->Composite = XAADoComposite;
+
+ if(!infoRec->Glyphs && infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY))
+ {
+ infoRec->Glyphs = XAADoGlyphs;
+ }
+ }
+
+ /************ Validation Functions **************/
+
+ if(!infoRec->ValidateCopyArea && infoRec->CopyArea) {
+ infoRec->CopyAreaMask = GCWhenForced;
+ if((infoRec->CopyAreaFlags & GXCOPY_ONLY) ||
+ (infoRec->CopyAreaFlags & ROP_NEEDS_SOURCE))
+ infoRec->CopyAreaMask |= GCFunction;
+ if(infoRec->CopyAreaFlags & NO_PLANEMASK)
+ infoRec->CopyAreaMask |= GCPlaneMask;
+ infoRec->ValidateCopyArea = XAAValidateCopyArea;
+ }
+
+ if(!infoRec->ValidateCopyPlane && infoRec->CopyPlane) {
+ infoRec->CopyPlaneMask = GCWhenForced;
+ if((infoRec->CopyPlaneFlags & GXCOPY_ONLY) ||
+ (infoRec->CopyPlaneFlags & ROP_NEEDS_SOURCE))
+ infoRec->CopyPlaneMask |= GCFunction;
+ if(infoRec->CopyPlaneFlags & NO_PLANEMASK)
+ infoRec->CopyPlaneMask |= GCPlaneMask;
+ if(infoRec->CopyPlaneFlags & RGB_EQUAL)
+ infoRec->CopyPlaneMask |= GCForeground | GCBackground;
+ infoRec->ValidateCopyPlane = XAAValidateCopyPlane;
+ }
+
+ if(!infoRec->ValidatePutImage && infoRec->PutImage) {
+ infoRec->PutImageMask = GCWhenForced;
+ if((infoRec->PutImageFlags & GXCOPY_ONLY) ||
+ (infoRec->PutImageFlags & ROP_NEEDS_SOURCE))
+ infoRec->PutImageMask |= GCFunction;
+ if(infoRec->PutImageFlags & NO_PLANEMASK)
+ infoRec->PutImageMask |= GCPlaneMask;
+ if(infoRec->PutImageFlags & RGB_EQUAL)
+ infoRec->PutImageMask |= GCForeground | GCBackground;
+ infoRec->ValidatePutImage = XAAValidatePutImage;
+ }
+
+
+ if(!infoRec->ValidatePushPixels && infoRec->PushPixelsSolid) {
+ infoRec->PushPixelsMask = GCFillStyle;
+ if((infoRec->PushPixelsFlags & GXCOPY_ONLY) ||
+ (infoRec->PushPixelsFlags & ROP_NEEDS_SOURCE) ||
+ (infoRec->PushPixelsFlags & TRANSPARENCY_GXCOPY_ONLY))
+ infoRec->PushPixelsMask |= GCFunction;
+ if(infoRec->PushPixelsFlags & NO_PLANEMASK)
+ infoRec->PushPixelsMask |= GCPlaneMask;
+ if(infoRec->PushPixelsFlags & RGB_EQUAL)
+ infoRec->PushPixelsMask |= GCForeground;
+ infoRec->ValidatePushPixels = XAAValidatePushPixels;
+ }
+
+ /* By default XAA assumes the FillSpans, PolyFillRects, FillPolygon
+ and PolyFillArcs have the same restrictions. If you supply GC
+ level replacements for any of these and alter this relationship
+ you may need to supply replacement validation routines */
+
+ if(!infoRec->ValidateFillSpans &&
+ (infoRec->FillSpansSolid || infoRec->FillSpansStippled ||
+ infoRec->FillSpansOpaqueStippled || infoRec->FillSpansTiled)) {
+
+ int compositeFlags = infoRec->FillSpansSolidFlags |
+ infoRec->FillSpansStippledFlags |
+ infoRec->FillSpansOpaqueStippledFlags |
+ infoRec->FillSpansTiledFlags;
+
+ infoRec->FillSpansMask = GCFillStyle | GCTile | GCStipple;
+
+ if((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE))
+ infoRec->FillSpansMask |= GCFunction;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->FillSpansMask |= GCPlaneMask;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->FillSpansMask |= GCForeground;
+ infoRec->ValidateFillSpans = XAAValidateFillSpans;
+ }
+
+ /* By default XAA only provides Validations for the GlyphBlt
+ functions and not the text higher up. This is because the
+ Text8/16 and GlyphBlt are linked. If you break this linkage,
+ you may need to have the driver supply its own Validation
+ routines */
+
+ if(!infoRec->ValidatePolyGlyphBlt &&
+ (infoRec->PolyGlyphBltTE || infoRec->PolyGlyphBltNonTE)) {
+ int compositeFlags = infoRec->PolyGlyphBltTEFlags |
+ infoRec->PolyGlyphBltNonTEFlags;
+
+ infoRec->PolyGlyphBltMask = GCFillStyle | GCFont;
+ if((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE) ||
+ (infoRec->PolyGlyphBltNonTEFlags & TRANSPARENCY_GXCOPY_ONLY))
+ infoRec->PolyGlyphBltMask |= GCFunction;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->PolyGlyphBltMask |= GCPlaneMask;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->PolyGlyphBltMask |= GCForeground;
+ infoRec->ValidatePolyGlyphBlt = XAAValidatePolyGlyphBlt;
+ }
+
+ if(!infoRec->ValidateImageGlyphBlt &&
+ (infoRec->ImageGlyphBltTE || infoRec->ImageGlyphBltNonTE)) {
+ int compositeFlags = infoRec->ImageGlyphBltTEFlags |
+ infoRec->ImageGlyphBltNonTEFlags;
+
+ if(infoRec->ImageGlyphBltNonTE)
+ compositeFlags |= infoRec->SolidFillFlags;
+
+ infoRec->ImageGlyphBltMask = GCFont;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->ImageGlyphBltMask |= GCPlaneMask;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->ImageGlyphBltMask |= GCForeground | GCBackground;
+ infoRec->ValidateImageGlyphBlt = XAAValidateImageGlyphBlt;
+ }
+
+ /* By default XAA only provides a Validation function for the
+ Polylines and does segments and polylines at the same time */
+
+ if(!infoRec->ValidatePolylines && infoRec->ValidateFillSpans) {
+ int compositeFlags = infoRec->PolyRectangleThinSolidFlags |
+ infoRec->PolylinesWideSolidFlags |
+ infoRec->PolylinesThinSolidFlags |
+ infoRec->PolySegmentThinSolidFlags |
+ infoRec->PolySegmentThinDashedFlags |
+ infoRec->PolylinesThinDashedFlags;
+
+ infoRec->ValidatePolylines = XAAValidatePolylines;
+ infoRec->PolylinesMask =
+ infoRec->FillSpansMask | GCLineStyle | GCLineWidth;
+
+ if(infoRec->PolySegmentThinDashed || infoRec->PolylinesThinDashed)
+ infoRec->PolylinesMask |= GCDashList;
+ if(compositeFlags & NO_PLANEMASK)
+ infoRec->PolylinesMask |= GCPlaneMask;
+ if((compositeFlags & GXCOPY_ONLY) ||
+ (compositeFlags & ROP_NEEDS_SOURCE))
+ infoRec->PolylinesMask |= GCFunction;
+ if(compositeFlags & RGB_EQUAL)
+ infoRec->PolylinesMask |= GCForeground;
+ }
+
+
+ /**** Fill choosers ****/
+
+ if(!infoRec->StippledFillChooser)
+ infoRec->StippledFillChooser = XAAStippledFillChooser;
+
+ if(!infoRec->OpaqueStippledFillChooser)
+ infoRec->OpaqueStippledFillChooser = XAAOpaqueStippledFillChooser;
+
+ if(!infoRec->TiledFillChooser)
+ infoRec->TiledFillChooser = XAATiledFillChooser;
+
+
+ /**** Setup the pixmap cache ****/
+
+ if(infoRec->WriteBitmapToCache) {}
+ else if(infoRec->WriteBitmap &&
+ !(infoRec->WriteBitmapFlags & TRANSPARENCY_ONLY))
+ infoRec->WriteBitmapToCache = XAAWriteBitmapToCache;
+ else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
+ infoRec->WriteBitmapToCache = XAAWriteBitmapToCacheLinear;
+ else
+ infoRec->PixmapCacheFlags |= DO_NOT_BLIT_STIPPLES;
+
+ if(infoRec->WritePixmapToCache) {}
+ else if(infoRec->WritePixmap && !(infoRec->WritePixmapFlags & NO_GXCOPY))
+ infoRec->WritePixmapToCache = XAAWritePixmapToCache;
+ else if(infoRec->Flags & LINEAR_FRAMEBUFFER)
+ infoRec->WritePixmapToCache = XAAWritePixmapToCacheLinear;
+ else
+ infoRec->Flags &= ~PIXMAP_CACHE;
+
+ if (xf86ReturnOptValBool(options, XAAOPT_PIXMAP_CACHE, FALSE))
+ infoRec->Flags &= ~PIXMAP_CACHE;
+
+ if(infoRec->WriteMono8x8PatternToCache) {}
+ else if(infoRec->PixmapCacheFlags & CACHE_MONO_8x8) {
+ if(infoRec->WritePixmapToCache)
+ infoRec->WriteMono8x8PatternToCache = XAAWriteMono8x8PatternToCache;
+ else
+ infoRec->PixmapCacheFlags &= ~CACHE_MONO_8x8;
+ }
+
+ if(infoRec->WriteColor8x8PatternToCache) {}
+ else if(infoRec->PixmapCacheFlags & CACHE_COLOR_8x8) {
+ if(infoRec->WritePixmapToCache && infoRec->WriteBitmapToCache)
+ infoRec->WriteColor8x8PatternToCache = XAAWriteColor8x8PatternToCache;
+ else
+ infoRec->PixmapCacheFlags &= ~CACHE_COLOR_8x8;
+ }
+
+ if(infoRec->CachePixelGranularity < 0) {
+ switch(pScrn->bitsPerPixel) {
+ case 24:
+ case 8: infoRec->CachePixelGranularity = 4; break;
+ case 16: infoRec->CachePixelGranularity = 2; break;
+ case 32: infoRec->CachePixelGranularity = 1; break;
+ default: break;
+ }
+
+ if(BITMAP_SCANLINE_PAD == 64)
+ infoRec->CachePixelGranularity *= 2;
+ }
+
+ free(options);
+
+ if(!infoRec->CacheTile && infoRec->WritePixmapToCache)
+ infoRec->CacheTile = XAACacheTile;
+ if(!infoRec->CacheMonoStipple && infoRec->WritePixmapToCache)
+ infoRec->CacheMonoStipple = XAACacheMonoStipple;
+ if(!infoRec->CacheStipple && infoRec->WriteBitmapToCache)
+ infoRec->CacheStipple = XAACacheStipple;
+ if(!infoRec->CacheMono8x8Pattern && infoRec->WriteMono8x8PatternToCache)
+ infoRec->CacheMono8x8Pattern = XAACacheMono8x8Pattern;
+ if(!infoRec->CacheColor8x8Pattern && infoRec->WriteColor8x8PatternToCache)
+ infoRec->CacheColor8x8Pattern = XAACacheColor8x8Pattern;
+
+ if((infoRec->Flags & PIXMAP_CACHE) && !infoRec->InitPixmapCache) {
+ infoRec->InitPixmapCache = XAAInitPixmapCache;
+ infoRec->ClosePixmapCache = XAAClosePixmapCache;
+ }
+
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaLineMisc.c b/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
index 6cef4bcd5..3e5330fd3 100644
--- a/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
+++ b/xorg-server/hw/xfree86/xaa/xaaLineMisc.c
@@ -1,151 +1,151 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "miline.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-
-
-void
-XAASolidHorVertLineAsRects(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- if(dir == DEGREES_0)
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, len, 1);
- else
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, len);
-}
-
-
-void
-XAASolidHorVertLineAsTwoPoint(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- len--;
-
- if(dir == DEGREES_0)
- (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x + len, y, 0);
- else
- (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x, y + len, 0);
-}
-
-void
-XAASolidHorVertLineAsBresenham(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- if(dir == DEGREES_0)
- (*infoRec->SubsequentSolidBresenhamLine)(
- pScrn, x, y, len << 1, 0, -len, len, 0);
- else
- (*infoRec->SubsequentSolidBresenhamLine)(
- pScrn, x, y, len << 1, 0, -len, len, YMAJOR);
-}
-
-
-void
-XAAComputeDash(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
- XAAGetGCKey());
- Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
- int PatternLength = 0;
- unsigned char* DashPtr = (unsigned char*)pGC->dash;
- CARD32 *ptr;
- int count = pGC->numInDashList;
- int shift, value, direction;
- Bool set;
-
- if(pGCPriv->DashPattern)
- xfree(pGCPriv->DashPattern);
-
- pGCPriv->DashPattern = NULL;
- pGCPriv->DashLength = 0;
-
- while(count--)
- PatternLength += *(DashPtr++);
-
- if(!EvenDash)
- PatternLength <<= 1;
-
- if(PatternLength > infoRec->DashPatternMaxLength)
- return;
-
- if((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
- (PatternLength & (PatternLength - 1)))
- return;
-
- pGCPriv->DashPattern = xcalloc((PatternLength + 31) >> 5, 4);
- if(!pGCPriv->DashPattern) return;
- pGCPriv->DashLength = PatternLength;
-
- if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
- LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
- direction = 1;
- set = TRUE;
- DashPtr = (unsigned char*)pGC->dash;
- } else {
- direction = -1;
- set = FALSE;
- DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList - 1;
- }
-
- if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
- LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
- shift = 32 - (PatternLength & 31);
- else
- shift = 0;
-
- ptr = (CARD32*)(pGCPriv->DashPattern);
-
-CONCATENATE:
-
- count = pGC->numInDashList;
-
- while(count--) {
- value = *DashPtr;
- DashPtr += direction;
- while(value) {
- if(value < (32 - shift)) {
- if(set) *ptr |= XAAShiftMasks[value] << shift;
- shift += value;
- break;
- } else {
- if(set) *ptr |= ~0L << shift;
- value -= (32 - shift);
- shift = 0;
- ptr++;
- }
- }
- if(set) set = FALSE;
- else set = TRUE;
- }
-
- if(!EvenDash) {
- EvenDash = TRUE;
- if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
- LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
- DashPtr = (unsigned char*)pGC->dash;
- else
- DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList;
- goto CONCATENATE;
- }
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "miline.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+
+
+void
+XAASolidHorVertLineAsRects(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ if(dir == DEGREES_0)
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, len, 1);
+ else
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, 1, len);
+}
+
+
+void
+XAASolidHorVertLineAsTwoPoint(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ len--;
+
+ if(dir == DEGREES_0)
+ (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x + len, y, 0);
+ else
+ (*infoRec->SubsequentSolidTwoPointLine)(pScrn, x, y, x, y + len, 0);
+}
+
+void
+XAASolidHorVertLineAsBresenham(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ if(dir == DEGREES_0)
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ pScrn, x, y, len << 1, 0, -len, len, 0);
+ else
+ (*infoRec->SubsequentSolidBresenhamLine)(
+ pScrn, x, y, len << 1, 0, -len, len, YMAJOR);
+}
+
+
+void
+XAAComputeDash(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ XAAGCPtr pGCPriv = (XAAGCPtr)dixLookupPrivate(&pGC->devPrivates,
+ XAAGetGCKey());
+ Bool EvenDash = (pGC->numInDashList & 0x01) ? FALSE : TRUE;
+ int PatternLength = 0;
+ unsigned char* DashPtr = (unsigned char*)pGC->dash;
+ CARD32 *ptr;
+ int count = pGC->numInDashList;
+ int shift, value, direction;
+ Bool set;
+
+ if(pGCPriv->DashPattern)
+ free(pGCPriv->DashPattern);
+
+ pGCPriv->DashPattern = NULL;
+ pGCPriv->DashLength = 0;
+
+ while(count--)
+ PatternLength += *(DashPtr++);
+
+ if(!EvenDash)
+ PatternLength <<= 1;
+
+ if(PatternLength > infoRec->DashPatternMaxLength)
+ return;
+
+ if((infoRec->DashedLineFlags & LINE_PATTERN_POWER_OF_2_ONLY) &&
+ (PatternLength & (PatternLength - 1)))
+ return;
+
+ pGCPriv->DashPattern = calloc((PatternLength + 31) >> 5, 4);
+ if(!pGCPriv->DashPattern) return;
+ pGCPriv->DashLength = PatternLength;
+
+ if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED)) {
+ direction = 1;
+ set = TRUE;
+ DashPtr = (unsigned char*)pGC->dash;
+ } else {
+ direction = -1;
+ set = FALSE;
+ DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList - 1;
+ }
+
+ if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_MSBFIRST_MSBJUSTIFIED))
+ shift = 32 - (PatternLength & 31);
+ else
+ shift = 0;
+
+ ptr = (CARD32*)(pGCPriv->DashPattern);
+
+CONCATENATE:
+
+ count = pGC->numInDashList;
+
+ while(count--) {
+ value = *DashPtr;
+ DashPtr += direction;
+ while(value) {
+ if(value < (32 - shift)) {
+ if(set) *ptr |= XAAShiftMasks[value] << shift;
+ shift += value;
+ break;
+ } else {
+ if(set) *ptr |= ~0L << shift;
+ value -= (32 - shift);
+ shift = 0;
+ ptr++;
+ }
+ }
+ if(set) set = FALSE;
+ else set = TRUE;
+ }
+
+ if(!EvenDash) {
+ EvenDash = TRUE;
+ if(infoRec->DashedLineFlags & (LINE_PATTERN_LSBFIRST_MSBJUSTIFIED |
+ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED))
+ DashPtr = (unsigned char*)pGC->dash;
+ else
+ DashPtr = (unsigned char*)pGC->dash + pGC->numInDashList;
+ goto CONCATENATE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaNonTEText.c b/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
index d32c0bbc5..eb798a82b 100644
--- a/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
+++ b/xorg-server/hw/xfree86/xaa/xaaNonTEText.c
@@ -1,591 +1,591 @@
-
-/********************************************************************
-
- In this file we have GC level replacements for PolyText8/16,
- ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional)
- fonts. The idea is that everything in this file is device independent.
- The mentioned GCOps are merely wrappers for the
- PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
- functions which calculate the boxes containing arbitrarily clipped
- text and passes them to the NonTEGlyphRenderer which will usually
- be a lower level XAA function which renders these clipped glyphs using
- the basic color expansion functions exported by the chipset driver.
- The NonTEGlyphRenderer itself may optionally be driver supplied to
- facilitate work-arounds/optimizations at a higher level than usual.
-
- Written by Mark Vojkovich (mvojkovi@ucsd.edu)
-
-********************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include <X11/fonts/font.h>
-#include "scrnintstr.h"
-#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaacexp.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-
-
-static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
- int xInit, int yInit, FontPtr font,
- int fg, int bg, unsigned planemask,
- RegionPtr cclip, int nglyph,
- unsigned char* gBase, CharInfoPtr *ppci);
-static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
- int xInit, int yInit, FontPtr font,
- int fg, int rop, unsigned planemask,
- RegionPtr cclip, int nglyph,
- unsigned char* gBase, CharInfoPtr *ppci);
-
-/********************************************************************
-
- GC level replacements for PolyText8/16 and ImageText8/16
- for NonTE fonts when using color expansion.
-
-********************************************************************/
-
-
-int
-XAAPolyText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
- int width = 0;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- if(n) {
- width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
- x + pDraw->x, y + pDraw->y, pGC->font,
- pGC->fgPixel, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
- infoRec->CharInfo);
- }
-
- return (x + width);
-}
-
-
-int
-XAAPolyText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
- int width = 0;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) {
- width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
- x + pDraw->x, y + pDraw->y, pGC->font,
- pGC->fgPixel, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
- infoRec->CharInfo);
- }
-
- return (x + width);
-}
-
-
-void
-XAAImageText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- char *chars
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- if(n) ImageGlyphBltNonTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-void
-XAAImageText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x,
- int y,
- int count,
- unsigned short *chars
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) ImageGlyphBltNonTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-
-/********************************************************************
-
- GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
- NonTE fonts when using color expansion.
-
-********************************************************************/
-
-
-void
-XAAImageGlyphBltNonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- pointer pglyphBase /* start of array of glyphs */
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- ImageGlyphBltNonTEColorExpansion(
- infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-void
-XAAPolyGlyphBltNonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci, /* array of character info */
- pointer pglyphBase /* start of array of glyphs */
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- PolyGlyphBltNonTEColorExpansion(
- infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-
-
-
-/********************************************************************
-
- ImageGlyphBltNonTEColorExpansion -
- PolyGlyphBltNonTEColorExpansion -
-
- These guys compute the clipped pieces of text and send it to
- the lower-level function which will handle acceleration of
- arbitrarily clipped text.
-
-********************************************************************/
-
-
-
-static int
-CollectCharacterInfo(
- NonTEGlyphPtr glyphs,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- FontPtr pfont
-){
- int i, w = 0;
-
- for(i = 0; i < nglyph; i++, ppci++, glyphs++) {
- glyphs->bits = (unsigned char*)((*ppci)->bits);
- glyphs->start = w + (*ppci)->metrics.leftSideBearing;
- glyphs->end = w + (*ppci)->metrics.rightSideBearing;
- glyphs->yoff = (*ppci)->metrics.ascent;
- glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
- glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
- w += (*ppci)->metrics.characterWidth;
- }
- return w;
-}
-
-
-static void
-PolyGlyphBltAsSingleBitmap (
- ScrnInfoPtr pScrn,
- int nglyph,
- FontPtr font,
- int xInit,
- int yInit,
- int nbox,
- BoxPtr pbox,
- int fg,
- int rop,
- unsigned planemask
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32 *block, *pntr, *bits;
- int pitch, topLine, botLine, top, bot, height;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge;
- int bitPitch, shift, size, i, skippix;
- NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
- Bool extra;
-
- Left = xInit + infoRec->GlyphInfo[0].start;
- Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
- Top = yInit - FONTMAXBOUNDS(font,ascent);
- Bottom = yInit + FONTMAXBOUNDS(font,descent);
-
- /* get into the first band that may contain part of our string */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- if(!nbox) return;
-
- pitch = (Right - Left + 31) >> 5;
- size = (pitch << 2) * (Bottom - Top);
- block = xcalloc(1, size);
-
- topLine = 10000; botLine = -10000;
-
- while(nglyph--) {
- top = -glyphs->yoff;
- bot = top + glyphs->height;
- if(top < topLine) topLine = top;
- if(bot > botLine) botLine = bot;
- skippix = glyphs->start - infoRec->GlyphInfo[0].start;
- bits = (CARD32*)glyphs->bits;
- bitPitch = glyphs->srcwidth >> 2;
- pntr = block + ((FONTMAXBOUNDS(font,ascent) + top) * pitch) +
- (skippix >> 5);
- shift = skippix & 31;
- extra = ((shift + glyphs->end - glyphs->start) > 32);
-
- for(i = top; i < bot; i++) {
- *pntr |= SHIFT_L(*bits, shift);
- if(extra)
- *(pntr + 1) |= SHIFT_R(*bits,32 - shift);
- pntr += pitch;
- bits += bitPitch;
- }
-
- glyphs++;
- }
-
- pntr = block + ((FONTMAXBOUNDS(font,ascent) + topLine) * pitch);
-
- Top = yInit + topLine;
- Bottom = yInit + botLine;
-
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- while(nbox && (Bottom > pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) {
- skippix = LeftEdge - Left;
- topLine = max(Top, pbox->y1);
- botLine = min(Bottom, pbox->y2);
- height = botLine - topLine;
-
- if(height > 0)
- (*infoRec->WriteBitmap)(pScrn, LeftEdge, topLine,
- RightEdge - LeftEdge, height,
- (unsigned char*)(pntr + ((topLine - Top) * pitch) +
- (skippix >> 5)),
- pitch << 2, skippix & 31, fg, -1, rop, planemask);
- }
-
- nbox--; pbox++;
- }
-
- xfree(block);
-}
-
-static void
-ImageGlyphBltNonTEColorExpansion(
- ScrnInfoPtr pScrn,
- int xInit, int yInit,
- FontPtr font,
- int fg, int bg,
- unsigned planemask,
- RegionPtr cclip,
- int nglyph,
- unsigned char* gBase,
- CharInfoPtr *ppci
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int skippix, skipglyph, width, n, i;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge, ytop, ybot;
- int nbox = REGION_NUM_RECTS(cclip);
- BoxPtr pbox = REGION_RECTS(cclip);
- Bool AlreadySetup = FALSE;
-
- width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
-
- /* find our backing rectangle dimensions */
- Left = xInit;
- Right = Left + width;
- Top = yInit - FONTASCENT(font);
- Bottom = yInit + FONTDESCENT(font);
-
- /* get into the first band that may contain part of our box */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- while(nbox && (Bottom >= pbox->y1)) {
- /* handle backing rect first */
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
- if(RightEdge > LeftEdge) {
- ytop = max(Top, pbox->y1);
- ybot = min(Bottom, pbox->y2);
-
- if(ybot > ytop) {
- if(!AlreadySetup) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, GXcopy, planemask);
- AlreadySetup = TRUE;
- }
- (*infoRec->SubsequentSolidFillRect)(pScrn,
- LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop);
- }
- }
- nbox--; pbox++;
- }
-
- nbox = REGION_NUM_RECTS(cclip);
- pbox = REGION_RECTS(cclip);
-
- if(infoRec->WriteBitmap && (nglyph > 1) &&
- ((FONTMAXBOUNDS(font, rightSideBearing) -
- FONTMINBOUNDS(font, leftSideBearing)) <= 32))
- {
- PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
- xInit, yInit, nbox, pbox,
- fg, GXcopy, planemask);
-
- return;
- }
-
- /* compute an approximate but covering bounding box */
- Left = xInit + infoRec->GlyphInfo[0].start;
- Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
- Top = yInit - FONTMAXBOUNDS(font,ascent);
- Bottom = yInit + FONTMAXBOUNDS(font,descent);
-
- /* get into the first band that may contain part of our box */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- /* stop when the lower edge of the box is beyond our string */
- while(nbox && (Bottom >= pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) { /* we're possibly drawing something */
- ytop = max(Top, pbox->y1);
- ybot = min(Bottom, pbox->y2);
- if(ybot > ytop) {
- skippix = LeftEdge - xInit;
- skipglyph = 0;
- while(skippix >= infoRec->GlyphInfo[skipglyph].end)
- skipglyph++;
-
- skippix = RightEdge - xInit;
- n = 0; i = skipglyph;
- while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
- i++; n++;
- }
-
- if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
- xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
- pbox, fg, GXcopy, planemask);
- }
- }
-
- nbox--; pbox++;
- }
-}
-
-
-static int
-PolyGlyphBltNonTEColorExpansion(
- ScrnInfoPtr pScrn,
- int xInit, int yInit,
- FontPtr font,
- int fg, int rop,
- unsigned planemask,
- RegionPtr cclip,
- int nglyph,
- unsigned char* gBase,
- CharInfoPtr *ppci
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int skippix, skipglyph, width, n, i;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge;
- int nbox = REGION_NUM_RECTS(cclip);
- BoxPtr pbox = REGION_RECTS(cclip);
-
- width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
-
- if(!nbox)
- return width;
-
- if((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
- ((FONTMAXBOUNDS(font, rightSideBearing) -
- FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
-
- PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
- xInit, yInit, nbox, pbox,
- fg, rop, planemask);
-
- return width;
- }
-
- /* compute an approximate but covering bounding box */
- Left = xInit + infoRec->GlyphInfo[0].start;
- Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
- Top = yInit - FONTMAXBOUNDS(font,ascent);
- Bottom = yInit + FONTMAXBOUNDS(font,descent);
-
- /* get into the first band that may contain part of our string */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- /* stop when the lower edge of the box is beyond our string */
- while(nbox && (Bottom >= pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) { /* we're possibly drawing something */
-
- skippix = LeftEdge - xInit;
- skipglyph = 0;
- while(skippix >= infoRec->GlyphInfo[skipglyph].end)
- skipglyph++;
-
- skippix = RightEdge - xInit;
- n = 0; i = skipglyph;
- while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
- i++; n++;
- }
-
- if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
- xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
- pbox, fg, rop, planemask);
- }
-
- nbox--; pbox++;
- }
- return width;
-}
-
-
-/* It is possible that the none of the glyphs passed to the
- NonTEGlyphRenderer will be drawn. This function being called
- indicates that part of the text string's bounding box is visible
- but not necessarily that any of the characters are visible */
-
-void XAANonTEGlyphRenderer(
- ScrnInfoPtr pScrn,
- int x, int y, int n,
- NonTEGlyphPtr glyphs,
- BoxPtr pbox,
- int fg, int rop,
- unsigned int planemask
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
- unsigned char *src;
-
- for(i = 0; i < n; i++, glyphs++) {
- x1 = x + glyphs->start;
- x2 = x + glyphs->end;
- y1 = y - glyphs->yoff;
- y2 = y1 + glyphs->height;
-
- if(y1 < pbox->y1) {
- skiptop = pbox->y1 - y1;
- y1 = pbox->y1;
- } else skiptop = 0;
- if(y2 > pbox->y2) y2 = pbox->y2;
- h = y2 - y1;
- if(h <= 0) continue;
-
- if(x1 < pbox->x1) {
- skipleft = pbox->x1 - x1;
- x1 = pbox->x1;
- } else skipleft = 0;
- if(x2 > pbox->x2) x2 = pbox->x2;
-
- w = x2 - x1;
-
- if(w > 0) {
- src = glyphs->bits + (skiptop * glyphs->srcwidth);
-
- if(skipleft) {
- src += (skipleft >> 5) << 2;
- skipleft &= 31;
- }
-
- (*infoRec->WriteBitmap)(pScrn, x1, y1, w, h, src,
- glyphs->srcwidth, skipleft, fg, -1, rop, planemask);
- }
- }
-
-}
+
+/********************************************************************
+
+ In this file we have GC level replacements for PolyText8/16,
+ ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for NonTE (proportional)
+ fonts. The idea is that everything in this file is device independent.
+ The mentioned GCOps are merely wrappers for the
+ PolyGlyphBltNonTEColorExpansion and ImageGlyphBltNonTEColorExpansion
+ functions which calculate the boxes containing arbitrarily clipped
+ text and passes them to the NonTEGlyphRenderer which will usually
+ be a lower level XAA function which renders these clipped glyphs using
+ the basic color expansion functions exported by the chipset driver.
+ The NonTEGlyphRenderer itself may optionally be driver supplied to
+ facilitate work-arounds/optimizations at a higher level than usual.
+
+ Written by Mark Vojkovich (mvojkovi@ucsd.edu)
+
+********************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/fonts/font.h>
+#include "scrnintstr.h"
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaacexp.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+
+static void ImageGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit, FontPtr font,
+ int fg, int bg, unsigned planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char* gBase, CharInfoPtr *ppci);
+static int PolyGlyphBltNonTEColorExpansion(ScrnInfoPtr pScrn,
+ int xInit, int yInit, FontPtr font,
+ int fg, int rop, unsigned planemask,
+ RegionPtr cclip, int nglyph,
+ unsigned char* gBase, CharInfoPtr *ppci);
+
+/********************************************************************
+
+ GC level replacements for PolyText8/16 and ImageText8/16
+ for NonTE fonts when using color expansion.
+
+********************************************************************/
+
+
+int
+XAAPolyText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+ int width = 0;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ if(n) {
+ width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
+ x + pDraw->x, y + pDraw->y, pGC->font,
+ pGC->fgPixel, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+ }
+
+ return (x + width);
+}
+
+
+int
+XAAPolyText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+ int width = 0;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) {
+ width = PolyGlyphBltNonTEColorExpansion( infoRec->pScrn,
+ x + pDraw->x, y + pDraw->y, pGC->font,
+ pGC->fgPixel, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font),
+ infoRec->CharInfo);
+ }
+
+ return (x + width);
+}
+
+
+void
+XAAImageText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ char *chars
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ if(n) ImageGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+void
+XAAImageText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x,
+ int y,
+ int count,
+ unsigned short *chars
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) ImageGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+
+/********************************************************************
+
+ GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
+ NonTE fonts when using color expansion.
+
+********************************************************************/
+
+
+void
+XAAImageGlyphBltNonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ ImageGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+void
+XAAPolyGlyphBltNonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ PolyGlyphBltNonTEColorExpansion(
+ infoRec->pScrn, xInit + pDraw->x, yInit + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+
+
+
+/********************************************************************
+
+ ImageGlyphBltNonTEColorExpansion -
+ PolyGlyphBltNonTEColorExpansion -
+
+ These guys compute the clipped pieces of text and send it to
+ the lower-level function which will handle acceleration of
+ arbitrarily clipped text.
+
+********************************************************************/
+
+
+
+static int
+CollectCharacterInfo(
+ NonTEGlyphPtr glyphs,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ FontPtr pfont
+){
+ int i, w = 0;
+
+ for(i = 0; i < nglyph; i++, ppci++, glyphs++) {
+ glyphs->bits = (unsigned char*)((*ppci)->bits);
+ glyphs->start = w + (*ppci)->metrics.leftSideBearing;
+ glyphs->end = w + (*ppci)->metrics.rightSideBearing;
+ glyphs->yoff = (*ppci)->metrics.ascent;
+ glyphs->height = glyphs->yoff + (*ppci)->metrics.descent;
+ glyphs->srcwidth = PADGLYPHWIDTHBYTES(glyphs->end - glyphs->start);
+ w += (*ppci)->metrics.characterWidth;
+ }
+ return w;
+}
+
+
+static void
+PolyGlyphBltAsSingleBitmap (
+ ScrnInfoPtr pScrn,
+ int nglyph,
+ FontPtr font,
+ int xInit,
+ int yInit,
+ int nbox,
+ BoxPtr pbox,
+ int fg,
+ int rop,
+ unsigned planemask
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *block, *pntr, *bits;
+ int pitch, topLine, botLine, top, bot, height;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge;
+ int bitPitch, shift, size, i, skippix;
+ NonTEGlyphPtr glyphs = infoRec->GlyphInfo;
+ Bool extra;
+
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font,ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font,descent);
+
+ /* get into the first band that may contain part of our string */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ if(!nbox) return;
+
+ pitch = (Right - Left + 31) >> 5;
+ size = (pitch << 2) * (Bottom - Top);
+ block = calloc(1, size);
+
+ topLine = 10000; botLine = -10000;
+
+ while(nglyph--) {
+ top = -glyphs->yoff;
+ bot = top + glyphs->height;
+ if(top < topLine) topLine = top;
+ if(bot > botLine) botLine = bot;
+ skippix = glyphs->start - infoRec->GlyphInfo[0].start;
+ bits = (CARD32*)glyphs->bits;
+ bitPitch = glyphs->srcwidth >> 2;
+ pntr = block + ((FONTMAXBOUNDS(font,ascent) + top) * pitch) +
+ (skippix >> 5);
+ shift = skippix & 31;
+ extra = ((shift + glyphs->end - glyphs->start) > 32);
+
+ for(i = top; i < bot; i++) {
+ *pntr |= SHIFT_L(*bits, shift);
+ if(extra)
+ *(pntr + 1) |= SHIFT_R(*bits,32 - shift);
+ pntr += pitch;
+ bits += bitPitch;
+ }
+
+ glyphs++;
+ }
+
+ pntr = block + ((FONTMAXBOUNDS(font,ascent) + topLine) * pitch);
+
+ Top = yInit + topLine;
+ Bottom = yInit + botLine;
+
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ while(nbox && (Bottom > pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) {
+ skippix = LeftEdge - Left;
+ topLine = max(Top, pbox->y1);
+ botLine = min(Bottom, pbox->y2);
+ height = botLine - topLine;
+
+ if(height > 0)
+ (*infoRec->WriteBitmap)(pScrn, LeftEdge, topLine,
+ RightEdge - LeftEdge, height,
+ (unsigned char*)(pntr + ((topLine - Top) * pitch) +
+ (skippix >> 5)),
+ pitch << 2, skippix & 31, fg, -1, rop, planemask);
+ }
+
+ nbox--; pbox++;
+ }
+
+ free(block);
+}
+
+static void
+ImageGlyphBltNonTEColorExpansion(
+ ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int bg,
+ unsigned planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char* gBase,
+ CharInfoPtr *ppci
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyph, width, n, i;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge, ytop, ybot;
+ int nbox = REGION_NUM_RECTS(cclip);
+ BoxPtr pbox = REGION_RECTS(cclip);
+ Bool AlreadySetup = FALSE;
+
+ width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
+
+ /* find our backing rectangle dimensions */
+ Left = xInit;
+ Right = Left + width;
+ Top = yInit - FONTASCENT(font);
+ Bottom = yInit + FONTDESCENT(font);
+
+ /* get into the first band that may contain part of our box */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ while(nbox && (Bottom >= pbox->y1)) {
+ /* handle backing rect first */
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+ if(RightEdge > LeftEdge) {
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+
+ if(ybot > ytop) {
+ if(!AlreadySetup) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, GXcopy, planemask);
+ AlreadySetup = TRUE;
+ }
+ (*infoRec->SubsequentSolidFillRect)(pScrn,
+ LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop);
+ }
+ }
+ nbox--; pbox++;
+ }
+
+ nbox = REGION_NUM_RECTS(cclip);
+ pbox = REGION_RECTS(cclip);
+
+ if(infoRec->WriteBitmap && (nglyph > 1) &&
+ ((FONTMAXBOUNDS(font, rightSideBearing) -
+ FONTMINBOUNDS(font, leftSideBearing)) <= 32))
+ {
+ PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
+ xInit, yInit, nbox, pbox,
+ fg, GXcopy, planemask);
+
+ return;
+ }
+
+ /* compute an approximate but covering bounding box */
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font,ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font,descent);
+
+ /* get into the first band that may contain part of our box */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while(nbox && (Bottom >= pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) { /* we're possibly drawing something */
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+ if(ybot > ytop) {
+ skippix = LeftEdge - xInit;
+ skipglyph = 0;
+ while(skippix >= infoRec->GlyphInfo[skipglyph].end)
+ skipglyph++;
+
+ skippix = RightEdge - xInit;
+ n = 0; i = skipglyph;
+ while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
+ i++; n++;
+ }
+
+ if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
+ xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
+ pbox, fg, GXcopy, planemask);
+ }
+ }
+
+ nbox--; pbox++;
+ }
+}
+
+
+static int
+PolyGlyphBltNonTEColorExpansion(
+ ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int rop,
+ unsigned planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char* gBase,
+ CharInfoPtr *ppci
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyph, width, n, i;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge;
+ int nbox = REGION_NUM_RECTS(cclip);
+ BoxPtr pbox = REGION_RECTS(cclip);
+
+ width = CollectCharacterInfo(infoRec->GlyphInfo, nglyph, ppci, font);
+
+ if(!nbox)
+ return width;
+
+ if((infoRec->WriteBitmap) && (rop == GXcopy) && (nglyph > 1) &&
+ ((FONTMAXBOUNDS(font, rightSideBearing) -
+ FONTMINBOUNDS(font, leftSideBearing)) <= 32)) {
+
+ PolyGlyphBltAsSingleBitmap(pScrn, nglyph, font,
+ xInit, yInit, nbox, pbox,
+ fg, rop, planemask);
+
+ return width;
+ }
+
+ /* compute an approximate but covering bounding box */
+ Left = xInit + infoRec->GlyphInfo[0].start;
+ Right = xInit + infoRec->GlyphInfo[nglyph - 1].end;
+ Top = yInit - FONTMAXBOUNDS(font,ascent);
+ Bottom = yInit + FONTMAXBOUNDS(font,descent);
+
+ /* get into the first band that may contain part of our string */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while(nbox && (Bottom >= pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) { /* we're possibly drawing something */
+
+ skippix = LeftEdge - xInit;
+ skipglyph = 0;
+ while(skippix >= infoRec->GlyphInfo[skipglyph].end)
+ skipglyph++;
+
+ skippix = RightEdge - xInit;
+ n = 0; i = skipglyph;
+ while((i < nglyph) && (skippix > infoRec->GlyphInfo[i].start)) {
+ i++; n++;
+ }
+
+ if(n) (*infoRec->NonTEGlyphRenderer)(pScrn,
+ xInit, yInit, n, infoRec->GlyphInfo + skipglyph,
+ pbox, fg, rop, planemask);
+ }
+
+ nbox--; pbox++;
+ }
+ return width;
+}
+
+
+/* It is possible that the none of the glyphs passed to the
+ NonTEGlyphRenderer will be drawn. This function being called
+ indicates that part of the text string's bounding box is visible
+ but not necessarily that any of the characters are visible */
+
+void XAANonTEGlyphRenderer(
+ ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop,
+ unsigned int planemask
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int x1, x2, y1, y2, i, w, h, skipleft, skiptop;
+ unsigned char *src;
+
+ for(i = 0; i < n; i++, glyphs++) {
+ x1 = x + glyphs->start;
+ x2 = x + glyphs->end;
+ y1 = y - glyphs->yoff;
+ y2 = y1 + glyphs->height;
+
+ if(y1 < pbox->y1) {
+ skiptop = pbox->y1 - y1;
+ y1 = pbox->y1;
+ } else skiptop = 0;
+ if(y2 > pbox->y2) y2 = pbox->y2;
+ h = y2 - y1;
+ if(h <= 0) continue;
+
+ if(x1 < pbox->x1) {
+ skipleft = pbox->x1 - x1;
+ x1 = pbox->x1;
+ } else skipleft = 0;
+ if(x2 > pbox->x2) x2 = pbox->x2;
+
+ w = x2 - x1;
+
+ if(w > 0) {
+ src = glyphs->bits + (skiptop * glyphs->srcwidth);
+
+ if(skipleft) {
+ src += (skipleft >> 5) << 2;
+ skipleft &= 31;
+ }
+
+ (*infoRec->WriteBitmap)(pScrn, x1, y1, w, h, src,
+ glyphs->srcwidth, skipleft, fg, -1, rop, planemask);
+ }
+ }
+
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOffscreen.c b/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
index 7c9d53270..41be2b491 100644
--- a/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
+++ b/xorg-server/hw/xfree86/xaa/xaaOffscreen.c
@@ -1,162 +1,162 @@
-
-/*
- Copyright (c) 1999 - The XFree86 Project Inc.
-
- Written by Mark Vojkovich
-
-*/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-
-void
-XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- XAAPixmapPtr pPriv;
-
- while(pLink) {
- pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
- pLink->area = pPriv->offscreenArea;
- XAAMoveOutOffscreenPixmap(pLink->pPix);
- pLink = pLink->next;
- }
-}
-
-
-
-void
-XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
- PixmapPtr pPix, pScreenPix, tmpPix;
- pointer data;
- XAAPixmapPtr pPriv;
- GCPtr pGC;
- FBAreaPtr area;
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- while(pLink) {
- pPix = pLink->pPix;
- pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- area = pLink->area;
-
- data = pPix->devPrivate.ptr;
- tmpPix = GetScratchPixmapHeader(pScreen,
- pPix->drawable.width, pPix->drawable.height,
- pPix->drawable.depth, pPix->drawable.bitsPerPixel,
- pPix->devKind, data);
-
- pPriv->freeData = FALSE;
-
- pPix->drawable.x = area->box.x1;
- pPix->drawable.y = area->box.y1;
- pPix->devKind = pScreenPix->devKind;
- pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
- pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
- pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- if(!tmpPix) {
- pPriv->offscreenArea = area;
- xfree(data);
- pLink = pLink->next;
- continue;
- }
-
- pGC = GetScratchGC(pPix->drawable.depth, pScreen);
- ValidateGC((DrawablePtr)pPix, pGC);
-
- (*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
- 0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
-
- xfree(data);
- tmpPix->devPrivate.ptr = NULL;
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(tmpPix);
-
- pPriv->offscreenArea = area;
- pLink->area = NULL;
- pLink = pLink->next;
- }
-}
-
-
-void
-XAARemoveAreaCallback(FBAreaPtr area)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
- PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
-
- XAAMoveOutOffscreenPixmap(pPix);
-
- pPriv->flags &= ~OFFSCREEN;
-
- DELIST_OFFSCREEN_PIXMAP(pPix);
-}
-
-void
-XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
-{
- ScreenPtr pScreen = pPix->drawable.pScreen;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- int width, height, devKind, bitsPerPixel;
- PixmapPtr tmpPix;
- unsigned char *data;
- GCPtr pGC;
-
- width = pPix->drawable.width;
- height = pPix->drawable.height;
- bitsPerPixel = pPix->drawable.bitsPerPixel;
-
- devKind = BitmapBytePad(width * bitsPerPixel);
- if(!(data = xalloc(devKind * height)))
- FatalError("Out of memory\n");
-
- tmpPix = GetScratchPixmapHeader(pScreen, width, height,
- pPix->drawable.depth, bitsPerPixel, devKind, data);
- if(!tmpPix) {
- xfree(data);
- FatalError("Out of memory\n");
- }
-
- pGC = GetScratchGC(pPix->drawable.depth, pScreen);
- ValidateGC((DrawablePtr)tmpPix, pGC);
-
- (*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
- pGC, 0, 0, width, height, 0, 0);
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(tmpPix);
-
- pPix->drawable.x = 0;
- pPix->drawable.y = 0;
- pPix->devKind = devKind;
- pPix->devPrivate.ptr = data;
- pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
-
- pPriv->offscreenArea = NULL;
- pPriv->freeData = TRUE;
-}
+
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+
+*/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+void
+XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ XAAPixmapPtr pPriv;
+
+ while(pLink) {
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pLink->pPix);
+ pLink->area = pPriv->offscreenArea;
+ XAAMoveOutOffscreenPixmap(pLink->pPix);
+ pLink = pLink->next;
+ }
+}
+
+
+
+void
+XAAMoveInOffscreenPixmaps(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ PixmapLinkPtr pLink = infoRec->OffscreenPixmaps;
+ PixmapPtr pPix, pScreenPix, tmpPix;
+ pointer data;
+ XAAPixmapPtr pPriv;
+ GCPtr pGC;
+ FBAreaPtr area;
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ while(pLink) {
+ pPix = pLink->pPix;
+ pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ area = pLink->area;
+
+ data = pPix->devPrivate.ptr;
+ tmpPix = GetScratchPixmapHeader(pScreen,
+ pPix->drawable.width, pPix->drawable.height,
+ pPix->drawable.depth, pPix->drawable.bitsPerPixel,
+ pPix->devKind, data);
+
+ pPriv->freeData = FALSE;
+
+ pPix->drawable.x = area->box.x1;
+ pPix->drawable.y = area->box.y1;
+ pPix->devKind = pScreenPix->devKind;
+ pPix->devPrivate.ptr = pScreenPix->devPrivate.ptr;
+ pPix->drawable.bitsPerPixel = infoRec->pScrn->bitsPerPixel;
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ if(!tmpPix) {
+ pPriv->offscreenArea = area;
+ free(data);
+ pLink = pLink->next;
+ continue;
+ }
+
+ pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+ ValidateGC((DrawablePtr)pPix, pGC);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)tmpPix, (DrawablePtr)pPix, pGC,
+ 0, 0, pPix->drawable.width, pPix->drawable.height, 0, 0);
+
+ free(data);
+ tmpPix->devPrivate.ptr = NULL;
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(tmpPix);
+
+ pPriv->offscreenArea = area;
+ pLink->area = NULL;
+ pLink = pLink->next;
+ }
+}
+
+
+void
+XAARemoveAreaCallback(FBAreaPtr area)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(area->pScreen);
+ PixmapPtr pPix = (PixmapPtr)area->devPrivate.ptr;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+
+ XAAMoveOutOffscreenPixmap(pPix);
+
+ pPriv->flags &= ~OFFSCREEN;
+
+ DELIST_OFFSCREEN_PIXMAP(pPix);
+}
+
+void
+XAAMoveOutOffscreenPixmap(PixmapPtr pPix)
+{
+ ScreenPtr pScreen = pPix->drawable.pScreen;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ int width, height, devKind, bitsPerPixel;
+ PixmapPtr tmpPix;
+ unsigned char *data;
+ GCPtr pGC;
+
+ width = pPix->drawable.width;
+ height = pPix->drawable.height;
+ bitsPerPixel = pPix->drawable.bitsPerPixel;
+
+ devKind = BitmapBytePad(width * bitsPerPixel);
+ if(!(data = malloc(devKind * height)))
+ FatalError("Out of memory\n");
+
+ tmpPix = GetScratchPixmapHeader(pScreen, width, height,
+ pPix->drawable.depth, bitsPerPixel, devKind, data);
+ if(!tmpPix) {
+ free(data);
+ FatalError("Out of memory\n");
+ }
+
+ pGC = GetScratchGC(pPix->drawable.depth, pScreen);
+ ValidateGC((DrawablePtr)tmpPix, pGC);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)pPix, (DrawablePtr)tmpPix,
+ pGC, 0, 0, width, height, 0, 0);
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(tmpPix);
+
+ pPix->drawable.x = 0;
+ pPix->drawable.y = 0;
+ pPix->devKind = devKind;
+ pPix->devPrivate.ptr = data;
+ pPix->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+
+ pPriv->offscreenArea = NULL;
+ pPriv->freeData = TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlay.c b/xorg-server/hw/xfree86/xaa/xaaOverlay.c
index 2956a3dbf..b7122a58f 100644
--- a/xorg-server/hw/xfree86/xaa/xaaOverlay.c
+++ b/xorg-server/hw/xfree86/xaa/xaaOverlay.c
@@ -1,129 +1,129 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-#include "mioverlay.h"
-
-#ifdef PANORAMIX
-#include "panoramiX.h"
-#include "panoramiXsrv.h"
-#endif
-
-static void
-XAACopyWindow8_32(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-){
- DDXPointPtr pptSrc, ppt;
- RegionRec rgnDst;
- BoxPtr pbox;
- int dx, dy, nbox;
- WindowPtr pwinRoot;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec =
- GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
- Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
- RegionPtr borderClip = &pWin->borderClip;
- Bool freeReg = FALSE;
-
- if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
- (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK))
- {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32);
- return;
- }
-
- pwinRoot = WindowTable[pScreen->myNum];
-
- if(doUnderlay)
- freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
-
- REGION_NULL(pScreen, &rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
- REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc);
-
- pbox = REGION_RECTS(&rgnDst);
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(!nbox ||
- !(pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
- REGION_UNINIT(pScreen, &rgnDst);
- return;
- }
- ppt = pptSrc;
-
- while(nbox--) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- ppt++; pbox++;
- }
-
- infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- xfree(pptSrc);
- REGION_UNINIT(pScreen, &rgnDst);
- if(freeReg)
- REGION_DESTROY(pScreen, borderClip);
-}
-
-static void
-XAASetColorKey8_32(
- ScreenPtr pScreen,
- int nbox,
- BoxPtr pbox
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- ScrnInfoPtr pScrn = infoRec->pScrn;
-
- /* I'm counting on writes being clipped away while switched away.
- If this isn't going to be true then I need to be wrapping instead. */
- if(!infoRec->pScrn->vtSema) return;
-
- (*infoRec->FillSolidRects)(pScrn, pScrn->colorKey << 24, GXcopy,
- 0xff000000, nbox, pbox);
-
- SET_SYNC_FLAG(infoRec);
-}
-
-void
-XAASetupOverlay8_32Planar(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- int i;
-
- pScreen->CopyWindow = XAACopyWindow8_32;
-
- if(!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
- miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);
-
- infoRec->FullPlanemask = ~0;
- for(i = 0; i < 32; i++) /* haven't thought about this much */
- infoRec->FullPlanemasks[i] = ~0;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+#include "mioverlay.h"
+
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
+static void
+XAACopyWindow8_32(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+){
+ DDXPointPtr pptSrc, ppt;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int dx, dy, nbox;
+ WindowPtr pwinRoot;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE((&pWin->drawable));
+ Bool doUnderlay = miOverlayCopyUnderlay(pScreen);
+ RegionPtr borderClip = &pWin->borderClip;
+ Bool freeReg = FALSE;
+
+ if (!infoRec->pScrn->vtSema || !infoRec->ScreenToScreenBitBlt ||
+ (infoRec->ScreenToScreenBitBltFlags & NO_PLANEMASK))
+ {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(infoRec->pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAACopyWindow8_32);
+ return;
+ }
+
+ pwinRoot = WindowTable[pScreen->myNum];
+
+ if(doUnderlay)
+ freeReg = miOverlayCollectUnderlayRegions(pWin, &borderClip);
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, borderClip, prgnSrc);
+
+ pbox = REGION_RECTS(&rgnDst);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(!nbox ||
+ !(pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
+ REGION_UNINIT(pScreen, &rgnDst);
+ return;
+ }
+ ppt = pptSrc;
+
+ while(nbox--) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ ppt++; pbox++;
+ }
+
+ infoRec->ScratchGC.planemask = doUnderlay ? 0x00ffffff : 0xff000000;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ free(pptSrc);
+ REGION_UNINIT(pScreen, &rgnDst);
+ if(freeReg)
+ REGION_DESTROY(pScreen, borderClip);
+}
+
+static void
+XAASetColorKey8_32(
+ ScreenPtr pScreen,
+ int nbox,
+ BoxPtr pbox
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+
+ /* I'm counting on writes being clipped away while switched away.
+ If this isn't going to be true then I need to be wrapping instead. */
+ if(!infoRec->pScrn->vtSema) return;
+
+ (*infoRec->FillSolidRects)(pScrn, pScrn->colorKey << 24, GXcopy,
+ 0xff000000, nbox, pbox);
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+XAASetupOverlay8_32Planar(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ int i;
+
+ pScreen->CopyWindow = XAACopyWindow8_32;
+
+ if(!(infoRec->FillSolidRectsFlags & NO_PLANEMASK))
+ miOverlaySetTransFunction(pScreen, XAASetColorKey8_32);
+
+ infoRec->FullPlanemask = ~0;
+ for(i = 0; i < 32; i++) /* haven't thought about this much */
+ infoRec->FullPlanemasks[i] = ~0;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
index 8db816e1e..4548935fd 100644
--- a/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
+++ b/xorg-server/hw/xfree86/xaa/xaaOverlayDF.c
@@ -1,1050 +1,1050 @@
-/*
- Copyright (c) 1999 - The XFree86 Project Inc.
-
- Written by Mark Vojkovich
-*/
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "servermd.h"
-
-/* Screen funcs */
-
-static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
-static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr);
-
-static int XAAOverStippledFillChooser(GCPtr);
-static int XAAOverOpaqueStippledFillChooser(GCPtr);
-static int XAAOverTiledFillChooser(GCPtr);
-
-/* GC funcs */
-
-static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *,
- int, int, int, int, int, int);
-static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr,
- int, int, int, int, int, int, unsigned long);
-static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int,
- int, int, int);
-static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr,
- int, xRectangle*);
-static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr,
- int*, int);
-static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr,
- int*, int);
-static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int,
- DDXPointPtr, int*, int);
-static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr,
- int*, int);
-static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *);
-static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char*);
-static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr*, pointer);
-static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr*, pointer);
-static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
-static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
-static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int,
- unsigned short*);
-static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
- unsigned int, CharInfoPtr *, pointer);
-static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int, xRectangle*);
-static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int,
- DDXPointPtr);
-static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int,
- DDXPointPtr);
-static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment*);
-static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int,
- DDXPointPtr);
-static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment*);
-static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
-static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc*);
-static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
- int, int, char*);
-
-
-typedef struct {
- ScrnInfoPtr pScrn;
- DepthChangeFuncPtr callback;
- int currentDepth;
-/* GC funcs */
- RegionPtr (*CopyArea)(DrawablePtr, DrawablePtr, GC *,
- int, int, int, int, int, int);
- RegionPtr (*CopyPlane)(DrawablePtr, DrawablePtr, GCPtr,
- int, int, int, int, int, int, unsigned long);
- void (*PushPixelsSolid)(GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
- void (*PolyFillRectSolid)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolyFillRectStippled)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolyFillRectOpaqueStippled)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolyFillRectTiled)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*FillSpansSolid)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
- void (*FillSpansStippled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
- void (*FillSpansOpaqueStippled)(DrawablePtr,GCPtr,int,DDXPointPtr,int*,int);
- void (*FillSpansTiled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
- int (*PolyText8TE)(DrawablePtr, GCPtr, int, int, int, char *);
- int (*PolyText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageText8TE)(DrawablePtr, GCPtr, int, int, int, char*);
- void (*ImageText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr*, pointer);
- void (*PolyGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr*, pointer);
- int (*PolyText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
- int (*PolyText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
- void (*ImageText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
- void (*ImageGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr *, pointer);
- void (*PolyGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
- CharInfoPtr *, pointer);
- void (*PolyRectangleThinSolid)(DrawablePtr, GCPtr, int, xRectangle*);
- void (*PolylinesWideSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
-
- void (*PolylinesThinSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
- void (*PolySegmentThinSolid)(DrawablePtr, GCPtr, int, xSegment*);
- void (*PolylinesThinDashed)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
- void (*PolySegmentThinDashed)(DrawablePtr, GCPtr, int, xSegment*);
- void (*FillPolygonSolid)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
- void (*FillPolygonStippled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
- void (*FillPolygonOpaqueStippled)(DrawablePtr, GCPtr, int, int, int,
- DDXPointPtr);
- void (*FillPolygonTiled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
- void (*PolyFillArcSolid)(DrawablePtr, GCPtr, int, xArc*);
- void (*PutImage)(DrawablePtr, GCPtr, int, int, int, int, int, int,
- int, char*);
- int (*StippledFillChooser)(GCPtr);
- int (*OpaqueStippledFillChooser)(GCPtr);
- int (*TiledFillChooser)(GCPtr);
-} XAAOverlayRec, *XAAOverlayPtr;
-
-static int XAAOverlayKeyIndex;
-static DevPrivateKey XAAOverlayKey = &XAAOverlayKeyIndex;
-
-#define GET_OVERLAY_PRIV(pScreen) \
- (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
-
-#define SWITCH_DEPTH(d) \
- if(pOverPriv->currentDepth != d) { \
- (*pOverPriv->callback)(pOverPriv->pScrn, d); \
- pOverPriv->currentDepth = d; \
- }
-
-
-Bool
-XAAInitDualFramebufferOverlay(
- ScreenPtr pScreen,
- DepthChangeFuncPtr callback
-){
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAOverlayPtr pOverPriv;
-
- if(!(pOverPriv = xalloc(sizeof(XAAOverlayRec))))
- return FALSE;
-
- dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
-
- pOverPriv->pScrn = pScrn;
- pOverPriv->callback = callback;
- pOverPriv->currentDepth = -1;
-
- /* Overwrite key screen functions. The XAA core will clean up */
-
- pScreen->CopyWindow = XAAOverCopyWindow;
- pScreen->WindowExposures = XAAOverWindowExposures;
-
- pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
- pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
- pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;
-
- infoRec->StippledFillChooser = XAAOverStippledFillChooser;
- infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
- infoRec->TiledFillChooser = XAAOverTiledFillChooser;
-
- /* wrap all XAA GC rendering */
-
- pOverPriv->CopyArea = infoRec->CopyArea;
- pOverPriv->CopyPlane = infoRec->CopyPlane;
- pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
- pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
- pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
- pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
- pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
- pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
- pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
- pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
- pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
- pOverPriv->PolyText8TE = infoRec->PolyText8TE;
- pOverPriv->PolyText16TE = infoRec->PolyText16TE;
- pOverPriv->ImageText8TE = infoRec->ImageText8TE;
- pOverPriv->ImageText16TE = infoRec->ImageText16TE;
- pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
- pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
- pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
- pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
- pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
- pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
- pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
- pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
- pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
- pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
- pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
- pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
- pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
- pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
- pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
- pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
- pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
- pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
- pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
- pOverPriv->PutImage = infoRec->PutImage;
-
-
- if(infoRec->CopyArea)
- infoRec->CopyArea = XAAOverCopyArea;
- if(infoRec->CopyPlane)
- infoRec->CopyPlane = XAAOverCopyPlane;
- if(infoRec->PushPixelsSolid)
- infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
- if(infoRec->PolyFillRectSolid)
- infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
- if(infoRec->PolyFillRectStippled)
- infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
- if(infoRec->PolyFillRectOpaqueStippled)
- infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
- if(infoRec->PolyFillRectTiled)
- infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
- if(infoRec->FillSpansSolid)
- infoRec->FillSpansSolid = XAAOverFillSpansSolid;
- if(infoRec->FillSpansStippled)
- infoRec->FillSpansStippled = XAAOverFillSpansStippled;
- if(infoRec->FillSpansOpaqueStippled)
- infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
- if(infoRec->FillSpansTiled)
- infoRec->FillSpansTiled = XAAOverFillSpansTiled;
- if(infoRec->PolyText8TE)
- infoRec->PolyText8TE = XAAOverPolyText8TE;
- if(infoRec->PolyText16TE)
- infoRec->PolyText16TE = XAAOverPolyText16TE;
- if(infoRec->ImageText8TE)
- infoRec->ImageText8TE = XAAOverImageText8TE;
- if(infoRec->ImageText16TE)
- infoRec->ImageText16TE = XAAOverImageText16TE;
- if(infoRec->ImageGlyphBltTE)
- infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
- if(infoRec->PolyGlyphBltTE)
- infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
- if(infoRec->PolyText8NonTE)
- infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
- if(infoRec->PolyText16NonTE)
- infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
- if(infoRec->ImageText8NonTE)
- infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
- if(infoRec->ImageText16NonTE)
- infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
- if(infoRec->ImageGlyphBltNonTE)
- infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
- if(infoRec->PolyGlyphBltNonTE)
- infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
- if(infoRec->PolyRectangleThinSolid)
- infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
- if(infoRec->PolylinesWideSolid)
- infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
- if(infoRec->PolylinesThinSolid)
- infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
- if(infoRec->PolySegmentThinSolid)
- infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
- if(infoRec->PolylinesThinDashed)
- infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
- if(infoRec->PolySegmentThinDashed)
- infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
- if(infoRec->FillPolygonSolid)
- infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
- if(infoRec->FillPolygonStippled)
- infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
- if(infoRec->FillPolygonOpaqueStippled)
- infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
- if(infoRec->FillPolygonTiled)
- infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
- if(infoRec->PolyFillArcSolid)
- infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
- if(infoRec->PutImage)
- infoRec->PutImage = XAAOverPutImage;
-
- return TRUE;
-}
-
-/*********************** Screen functions ************************/
-
-void
-XAAOverCopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
- ScrnInfoPtr pScrn = infoRec->pScrn;
- DDXPointPtr ppt, pptSrc;
- RegionRec rgnDst;
- BoxPtr pbox;
- int i, nbox, dx, dy;
- WindowPtr pRoot = WindowTable[pScreen->myNum];
-
-
- if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
- XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
- if(pScrn->vtSema && infoRec->NeedToSync) {
- (*infoRec->Sync)(pScrn);
- infoRec->NeedToSync = FALSE;
- }
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow);
- return;
- }
-
- infoRec->ScratchGC.alu = GXcopy;
- infoRec->ScratchGC.planemask = ~0;
-
- REGION_NULL(pScreen, &rgnDst);
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
- REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
-
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(nbox &&
- (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))) {
-
- pbox = REGION_RECTS(&rgnDst);
- for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- SWITCH_DEPTH(8);
- XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
-
- if(pWin->drawable.bitsPerPixel != 8) {
- SWITCH_DEPTH(pScrn->depth);
- XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
- }
-
- xfree(pptSrc);
- }
-
- REGION_UNINIT(pScreen, &rgnDst);
-
- if(pWin->drawable.depth == 8) {
- REGION_NULL(pScreen, &rgnDst);
- miSegregateChildren(pWin, &rgnDst, pScrn->depth);
- if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
- REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
- nbox = REGION_NUM_RECTS(&rgnDst);
- if(nbox &&
- (pptSrc = (DDXPointPtr )xalloc(nbox * sizeof(DDXPointRec)))){
-
- pbox = REGION_RECTS(&rgnDst);
- for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
- ppt->x = pbox->x1 + dx;
- ppt->y = pbox->y1 + dy;
- }
-
- SWITCH_DEPTH(pScrn->depth);
- XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
- &(infoRec->ScratchGC), &rgnDst, pptSrc);
- xfree(pptSrc);
- }
- }
- REGION_UNINIT(pScreen, &rgnDst);
- }
-}
-
-
-void
-XAAOverWindowExposures(
- WindowPtr pWin,
- RegionPtr pReg,
- RegionPtr pOtherReg
-){
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
-
- if((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
- if(REGION_NUM_RECTS(pReg) && infoRec->FillSolidRects) {
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
-
- SWITCH_DEPTH(8);
- (*infoRec->FillSolidRects)(infoRec->pScrn,
- infoRec->pScrn->colorKey, GXcopy, ~0,
- REGION_NUM_RECTS(pReg), REGION_RECTS(pReg));
- miWindowExposures(pWin, pReg, pOtherReg);
- return;
- } else if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
- }
-
- XAA_SCREEN_PROLOGUE (pScreen, WindowExposures);
- (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
- XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
-}
-
-/********************* Choosers *************************/
-
-static int
-XAAOverStippledFillChooser(GCPtr pGC)
-{
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
- int ret;
-
- ret = (*pOverPriv->StippledFillChooser)(pGC);
-
- if((pGC->depth == 8) &&
- ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
- ret = 0;
- }
-
- return ret;
-}
-
-static int
-XAAOverOpaqueStippledFillChooser(GCPtr pGC)
-{
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
- int ret;
-
- ret = (*pOverPriv->OpaqueStippledFillChooser)(pGC);
-
- if((pGC->depth == 8) &&
- ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
- ret = 0;
- }
-
- return ret;
-}
-
-static int
-XAAOverTiledFillChooser(GCPtr pGC)
-{
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
- int ret;
-
- ret = (*pOverPriv->TiledFillChooser)(pGC);
-
- if((pGC->depth == 8) &&
- ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
- ret = 0;
- }
-
- return ret;
-}
-
-
-/**************************** GC Functions **************************/
-
-static RegionPtr
-XAAOverCopyArea(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->CopyArea)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty);
-}
-
-static RegionPtr
-XAAOverCopyPlane(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx, int srcy,
- int width, int height,
- int dstx, int dsty,
- unsigned long bitPlane
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->CopyPlane)(pSrc, pDst,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
-
-}
-
-static void
-XAAOverPushPixelsSolid(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDraw,
- int dx, int dy,
- int xOrg, int yOrg
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PushPixelsSolid)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
-}
-
-
-
-static void
-XAAOverPolyFillRectSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectSolid)(pDraw, pGC, nrectFill, prectInit);
-}
-
-static void
-XAAOverPolyFillRectStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectStippled)(pDraw, pGC, nrectFill, prectInit);
-}
-
-
-static void
-XAAOverPolyFillRectOpaqueStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectOpaqueStippled)(pDraw, pGC, nrectFill, prectInit);
-}
-
-static void
-XAAOverPolyFillRectTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillRectTiled)(pDraw, pGC, nrectFill, prectInit);
-}
-
-
-static void
-XAAOverFillSpansSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansSolid)(
- pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-
-static void
-XAAOverFillSpansStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansStippled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-static void
-XAAOverFillSpansOpaqueStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansOpaqueStippled)(
- pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-
-static void
-XAAOverFillSpansTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nInit,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillSpansTiled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
-}
-
-static int
-XAAOverPolyText8TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText8TE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static int
-XAAOverPolyText16TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText16TE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static void
-XAAOverImageText8TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText8TE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static void
-XAAOverImageText16TE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText16TE)(pDraw, pGC, x, y, count, chars);
-}
-
-static void
-XAAOverImageGlyphBltTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageGlyphBltTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static void
-XAAOverPolyGlyphBltTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyGlyphBltTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static int
-XAAOverPolyText8NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText8NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static int
-XAAOverPolyText16NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- return (*pOverPriv->PolyText16NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-static void
-XAAOverImageText8NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText8NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-static void
-XAAOverImageText16NonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageText16NonTE)(pDraw, pGC, x, y, count, chars);
-}
-
-
-static void
-XAAOverImageGlyphBltNonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->ImageGlyphBltNonTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static void
-XAAOverPolyGlyphBltNonTE(
- DrawablePtr pDraw,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyGlyphBltNonTE)(
- pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
-}
-
-static void
-XAAOverPolyRectangleThinSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyRectangleThinSolid)(pDraw, pGC, nRectsInit, pRectsInit);
-}
-
-
-
-static void
-XAAOverPolylinesWideSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolylinesWideSolid)(pDraw, pGC, mode, npt, pPts);
-}
-
-
-static void
-XAAOverPolylinesThinSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolylinesThinSolid)(pDraw, pGC, mode, npt, pPts);
-}
-
-static void
-XAAOverPolySegmentThinSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolySegmentThinSolid)(pDraw, pGC, nseg, pSeg);
-}
-
-static void
-XAAOverPolylinesThinDashed(
- DrawablePtr pDraw,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolylinesThinDashed)(pDraw, pGC, mode, npt, pPts);
-}
-
-static void
-XAAOverPolySegmentThinDashed(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolySegmentThinDashed)(pDraw, pGC, nseg, pSeg);
-}
-
-
-static void
-XAAOverFillPolygonSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonSolid)(pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-static void
-XAAOverFillPolygonStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonStippled)(pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-
-static void
-XAAOverFillPolygonOpaqueStippled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonOpaqueStippled)(
- pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-static void
-XAAOverFillPolygonTiled(
- DrawablePtr pDraw,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->FillPolygonTiled)(pDraw, pGC, shape, mode, count, ptsIn);
-}
-
-
-static void
-XAAOverPolyFillArcSolid(
- DrawablePtr pDraw,
- GCPtr pGC,
- int narcs,
- xArc *parcs
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PolyFillArcSolid)(pDraw, pGC, narcs, parcs);
-}
-
-
-static void
-XAAOverPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
-){
- XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
-
- SWITCH_DEPTH(pGC->depth);
-
- (*pOverPriv->PutImage)(pDraw, pGC, depth, x, y, w, h,
- leftPad, format, pImage);
-}
-
+/*
+ Copyright (c) 1999 - The XFree86 Project Inc.
+
+ Written by Mark Vojkovich
+*/
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "servermd.h"
+
+/* Screen funcs */
+
+static void XAAOverCopyWindow(WindowPtr, DDXPointRec, RegionPtr);
+static void XAAOverWindowExposures(WindowPtr, RegionPtr, RegionPtr);
+
+static int XAAOverStippledFillChooser(GCPtr);
+static int XAAOverOpaqueStippledFillChooser(GCPtr);
+static int XAAOverTiledFillChooser(GCPtr);
+
+/* GC funcs */
+
+static RegionPtr XAAOverCopyArea(DrawablePtr, DrawablePtr, GC *,
+ int, int, int, int, int, int);
+static RegionPtr XAAOverCopyPlane(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int, unsigned long);
+static void XAAOverPushPixelsSolid(GCPtr, PixmapPtr, DrawablePtr, int,
+ int, int, int);
+static void XAAOverPolyFillRectSolid(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverPolyFillRectStippled(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverPolyFillRectOpaqueStippled(DrawablePtr, GCPtr,
+ int, xRectangle*);
+static void XAAOverPolyFillRectTiled(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverFillSpansSolid(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int*, int);
+static void XAAOverFillSpansStippled(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int*, int);
+static void XAAOverFillSpansOpaqueStippled(DrawablePtr, GCPtr, int,
+ DDXPointPtr, int*, int);
+static void XAAOverFillSpansTiled(DrawablePtr, GCPtr, int, DDXPointPtr,
+ int*, int);
+static int XAAOverPolyText8TE(DrawablePtr, GCPtr, int, int, int, char *);
+static int XAAOverPolyText16TE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageText8TE(DrawablePtr, GCPtr, int, int, int, char*);
+static void XAAOverImageText16TE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageGlyphBltTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr*, pointer);
+static void XAAOverPolyGlyphBltTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr*, pointer);
+static int XAAOverPolyText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
+static int XAAOverPolyText16NonTE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageText8NonTE(DrawablePtr, GCPtr, int, int, int, char*);
+static void XAAOverImageText16NonTE(DrawablePtr, GCPtr, int, int, int,
+ unsigned short*);
+static void XAAOverImageGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyGlyphBltNonTE(DrawablePtr, GCPtr, int, int,
+ unsigned int, CharInfoPtr *, pointer);
+static void XAAOverPolyRectangleThinSolid(DrawablePtr, GCPtr, int, xRectangle*);
+static void XAAOverPolylinesWideSolid(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolylinesThinSolid(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolySegmentThinSolid(DrawablePtr, GCPtr, int, xSegment*);
+static void XAAOverPolylinesThinDashed(DrawablePtr, GCPtr, int, int,
+ DDXPointPtr);
+static void XAAOverPolySegmentThinDashed(DrawablePtr, GCPtr, int, xSegment*);
+static void XAAOverFillPolygonSolid(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonStippled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonOpaqueStippled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverFillPolygonTiled(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+static void XAAOverPolyFillArcSolid(DrawablePtr, GCPtr, int, xArc*);
+static void XAAOverPutImage(DrawablePtr, GCPtr, int, int, int, int, int,
+ int, int, char*);
+
+
+typedef struct {
+ ScrnInfoPtr pScrn;
+ DepthChangeFuncPtr callback;
+ int currentDepth;
+/* GC funcs */
+ RegionPtr (*CopyArea)(DrawablePtr, DrawablePtr, GC *,
+ int, int, int, int, int, int);
+ RegionPtr (*CopyPlane)(DrawablePtr, DrawablePtr, GCPtr,
+ int, int, int, int, int, int, unsigned long);
+ void (*PushPixelsSolid)(GCPtr, PixmapPtr, DrawablePtr, int, int, int, int);
+ void (*PolyFillRectSolid)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolyFillRectStippled)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolyFillRectOpaqueStippled)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolyFillRectTiled)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*FillSpansSolid)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
+ void (*FillSpansStippled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
+ void (*FillSpansOpaqueStippled)(DrawablePtr,GCPtr,int,DDXPointPtr,int*,int);
+ void (*FillSpansTiled)(DrawablePtr, GCPtr, int, DDXPointPtr, int*, int);
+ int (*PolyText8TE)(DrawablePtr, GCPtr, int, int, int, char *);
+ int (*PolyText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageText8TE)(DrawablePtr, GCPtr, int, int, int, char*);
+ void (*ImageText16TE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr*, pointer);
+ void (*PolyGlyphBltTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr*, pointer);
+ int (*PolyText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
+ int (*PolyText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageText8NonTE)(DrawablePtr, GCPtr, int, int, int, char*);
+ void (*ImageText16NonTE)(DrawablePtr, GCPtr, int, int, int, unsigned short*);
+ void (*ImageGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyGlyphBltNonTE)(DrawablePtr, GCPtr, int, int, unsigned int,
+ CharInfoPtr *, pointer);
+ void (*PolyRectangleThinSolid)(DrawablePtr, GCPtr, int, xRectangle*);
+ void (*PolylinesWideSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+
+ void (*PolylinesThinSolid)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+ void (*PolySegmentThinSolid)(DrawablePtr, GCPtr, int, xSegment*);
+ void (*PolylinesThinDashed)(DrawablePtr, GCPtr, int, int, DDXPointPtr);
+ void (*PolySegmentThinDashed)(DrawablePtr, GCPtr, int, xSegment*);
+ void (*FillPolygonSolid)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*FillPolygonStippled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*FillPolygonOpaqueStippled)(DrawablePtr, GCPtr, int, int, int,
+ DDXPointPtr);
+ void (*FillPolygonTiled)(DrawablePtr, GCPtr, int, int, int, DDXPointPtr);
+ void (*PolyFillArcSolid)(DrawablePtr, GCPtr, int, xArc*);
+ void (*PutImage)(DrawablePtr, GCPtr, int, int, int, int, int, int,
+ int, char*);
+ int (*StippledFillChooser)(GCPtr);
+ int (*OpaqueStippledFillChooser)(GCPtr);
+ int (*TiledFillChooser)(GCPtr);
+} XAAOverlayRec, *XAAOverlayPtr;
+
+static int XAAOverlayKeyIndex;
+static DevPrivateKey XAAOverlayKey = &XAAOverlayKeyIndex;
+
+#define GET_OVERLAY_PRIV(pScreen) \
+ (XAAOverlayPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAOverlayKey)
+
+#define SWITCH_DEPTH(d) \
+ if(pOverPriv->currentDepth != d) { \
+ (*pOverPriv->callback)(pOverPriv->pScrn, d); \
+ pOverPriv->currentDepth = d; \
+ }
+
+
+Bool
+XAAInitDualFramebufferOverlay(
+ ScreenPtr pScreen,
+ DepthChangeFuncPtr callback
+){
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAOverlayPtr pOverPriv;
+
+ if(!(pOverPriv = malloc(sizeof(XAAOverlayRec))))
+ return FALSE;
+
+ dixSetPrivate(&pScreen->devPrivates, XAAOverlayKey, pOverPriv);
+
+ pOverPriv->pScrn = pScrn;
+ pOverPriv->callback = callback;
+ pOverPriv->currentDepth = -1;
+
+ /* Overwrite key screen functions. The XAA core will clean up */
+
+ pScreen->CopyWindow = XAAOverCopyWindow;
+ pScreen->WindowExposures = XAAOverWindowExposures;
+
+ pOverPriv->StippledFillChooser = infoRec->StippledFillChooser;
+ pOverPriv->OpaqueStippledFillChooser = infoRec->OpaqueStippledFillChooser;
+ pOverPriv->TiledFillChooser = infoRec->TiledFillChooser;
+
+ infoRec->StippledFillChooser = XAAOverStippledFillChooser;
+ infoRec->OpaqueStippledFillChooser = XAAOverOpaqueStippledFillChooser;
+ infoRec->TiledFillChooser = XAAOverTiledFillChooser;
+
+ /* wrap all XAA GC rendering */
+
+ pOverPriv->CopyArea = infoRec->CopyArea;
+ pOverPriv->CopyPlane = infoRec->CopyPlane;
+ pOverPriv->PushPixelsSolid = infoRec->PushPixelsSolid;
+ pOverPriv->PolyFillRectSolid = infoRec->PolyFillRectSolid;
+ pOverPriv->PolyFillRectStippled = infoRec->PolyFillRectStippled;
+ pOverPriv->PolyFillRectOpaqueStippled = infoRec->PolyFillRectOpaqueStippled;
+ pOverPriv->PolyFillRectTiled = infoRec->PolyFillRectTiled;
+ pOverPriv->FillSpansSolid = infoRec->FillSpansSolid;
+ pOverPriv->FillSpansStippled = infoRec->FillSpansStippled;
+ pOverPriv->FillSpansOpaqueStippled = infoRec->FillSpansOpaqueStippled;
+ pOverPriv->FillSpansTiled = infoRec->FillSpansTiled;
+ pOverPriv->PolyText8TE = infoRec->PolyText8TE;
+ pOverPriv->PolyText16TE = infoRec->PolyText16TE;
+ pOverPriv->ImageText8TE = infoRec->ImageText8TE;
+ pOverPriv->ImageText16TE = infoRec->ImageText16TE;
+ pOverPriv->ImageGlyphBltTE = infoRec->ImageGlyphBltTE;
+ pOverPriv->PolyGlyphBltTE = infoRec->PolyGlyphBltTE;
+ pOverPriv->PolyText8NonTE = infoRec->PolyText8NonTE;
+ pOverPriv->PolyText16NonTE = infoRec->PolyText16NonTE;
+ pOverPriv->ImageText8NonTE = infoRec->ImageText8NonTE;
+ pOverPriv->ImageText16NonTE = infoRec->ImageText16NonTE;
+ pOverPriv->ImageGlyphBltNonTE = infoRec->ImageGlyphBltNonTE;
+ pOverPriv->PolyGlyphBltNonTE = infoRec->PolyGlyphBltNonTE;
+ pOverPriv->PolyRectangleThinSolid = infoRec->PolyRectangleThinSolid;
+ pOverPriv->PolylinesWideSolid = infoRec->PolylinesWideSolid;
+ pOverPriv->PolylinesThinSolid = infoRec->PolylinesThinSolid;
+ pOverPriv->PolySegmentThinSolid = infoRec->PolySegmentThinSolid;
+ pOverPriv->PolylinesThinDashed = infoRec->PolylinesThinDashed;
+ pOverPriv->PolySegmentThinDashed = infoRec->PolySegmentThinDashed;
+ pOverPriv->FillPolygonSolid = infoRec->FillPolygonSolid;
+ pOverPriv->FillPolygonStippled = infoRec->FillPolygonStippled;
+ pOverPriv->FillPolygonOpaqueStippled = infoRec->FillPolygonOpaqueStippled;
+ pOverPriv->FillPolygonTiled = infoRec->FillPolygonTiled;
+ pOverPriv->PolyFillArcSolid = infoRec->PolyFillArcSolid;
+ pOverPriv->PutImage = infoRec->PutImage;
+
+
+ if(infoRec->CopyArea)
+ infoRec->CopyArea = XAAOverCopyArea;
+ if(infoRec->CopyPlane)
+ infoRec->CopyPlane = XAAOverCopyPlane;
+ if(infoRec->PushPixelsSolid)
+ infoRec->PushPixelsSolid = XAAOverPushPixelsSolid;
+ if(infoRec->PolyFillRectSolid)
+ infoRec->PolyFillRectSolid = XAAOverPolyFillRectSolid;
+ if(infoRec->PolyFillRectStippled)
+ infoRec->PolyFillRectStippled = XAAOverPolyFillRectStippled;
+ if(infoRec->PolyFillRectOpaqueStippled)
+ infoRec->PolyFillRectOpaqueStippled = XAAOverPolyFillRectOpaqueStippled;
+ if(infoRec->PolyFillRectTiled)
+ infoRec->PolyFillRectTiled = XAAOverPolyFillRectTiled;
+ if(infoRec->FillSpansSolid)
+ infoRec->FillSpansSolid = XAAOverFillSpansSolid;
+ if(infoRec->FillSpansStippled)
+ infoRec->FillSpansStippled = XAAOverFillSpansStippled;
+ if(infoRec->FillSpansOpaqueStippled)
+ infoRec->FillSpansOpaqueStippled = XAAOverFillSpansOpaqueStippled;
+ if(infoRec->FillSpansTiled)
+ infoRec->FillSpansTiled = XAAOverFillSpansTiled;
+ if(infoRec->PolyText8TE)
+ infoRec->PolyText8TE = XAAOverPolyText8TE;
+ if(infoRec->PolyText16TE)
+ infoRec->PolyText16TE = XAAOverPolyText16TE;
+ if(infoRec->ImageText8TE)
+ infoRec->ImageText8TE = XAAOverImageText8TE;
+ if(infoRec->ImageText16TE)
+ infoRec->ImageText16TE = XAAOverImageText16TE;
+ if(infoRec->ImageGlyphBltTE)
+ infoRec->ImageGlyphBltTE = XAAOverImageGlyphBltTE;
+ if(infoRec->PolyGlyphBltTE)
+ infoRec->PolyGlyphBltTE = XAAOverPolyGlyphBltTE;
+ if(infoRec->PolyText8NonTE)
+ infoRec->PolyText8NonTE = XAAOverPolyText8NonTE;
+ if(infoRec->PolyText16NonTE)
+ infoRec->PolyText16NonTE = XAAOverPolyText16NonTE;
+ if(infoRec->ImageText8NonTE)
+ infoRec->ImageText8NonTE = XAAOverImageText8NonTE;
+ if(infoRec->ImageText16NonTE)
+ infoRec->ImageText16NonTE = XAAOverImageText16NonTE;
+ if(infoRec->ImageGlyphBltNonTE)
+ infoRec->ImageGlyphBltNonTE = XAAOverImageGlyphBltNonTE;
+ if(infoRec->PolyGlyphBltNonTE)
+ infoRec->PolyGlyphBltNonTE = XAAOverPolyGlyphBltNonTE;
+ if(infoRec->PolyRectangleThinSolid)
+ infoRec->PolyRectangleThinSolid = XAAOverPolyRectangleThinSolid;
+ if(infoRec->PolylinesWideSolid)
+ infoRec->PolylinesWideSolid = XAAOverPolylinesWideSolid;
+ if(infoRec->PolylinesThinSolid)
+ infoRec->PolylinesThinSolid = XAAOverPolylinesThinSolid;
+ if(infoRec->PolySegmentThinSolid)
+ infoRec->PolySegmentThinSolid = XAAOverPolySegmentThinSolid;
+ if(infoRec->PolylinesThinDashed)
+ infoRec->PolylinesThinDashed = XAAOverPolylinesThinDashed;
+ if(infoRec->PolySegmentThinDashed)
+ infoRec->PolySegmentThinDashed = XAAOverPolySegmentThinDashed;
+ if(infoRec->FillPolygonSolid)
+ infoRec->FillPolygonSolid = XAAOverFillPolygonSolid;
+ if(infoRec->FillPolygonStippled)
+ infoRec->FillPolygonStippled = XAAOverFillPolygonStippled;
+ if(infoRec->FillPolygonOpaqueStippled)
+ infoRec->FillPolygonOpaqueStippled = XAAOverFillPolygonOpaqueStippled;
+ if(infoRec->FillPolygonTiled)
+ infoRec->FillPolygonTiled = XAAOverFillPolygonTiled;
+ if(infoRec->PolyFillArcSolid)
+ infoRec->PolyFillArcSolid = XAAOverPolyFillArcSolid;
+ if(infoRec->PutImage)
+ infoRec->PutImage = XAAOverPutImage;
+
+ return TRUE;
+}
+
+/*********************** Screen functions ************************/
+
+void
+XAAOverCopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+){
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
+ ScrnInfoPtr pScrn = infoRec->pScrn;
+ DDXPointPtr ppt, pptSrc;
+ RegionRec rgnDst;
+ BoxPtr pbox;
+ int i, nbox, dx, dy;
+ WindowPtr pRoot = WindowTable[pScreen->myNum];
+
+
+ if (!pScrn->vtSema || !infoRec->ScreenToScreenBitBlt) {
+ XAA_SCREEN_PROLOGUE (pScreen, CopyWindow);
+ if(pScrn->vtSema && infoRec->NeedToSync) {
+ (*infoRec->Sync)(pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ XAA_SCREEN_EPILOGUE (pScreen, CopyWindow, XAAOverCopyWindow);
+ return;
+ }
+
+ infoRec->ScratchGC.alu = GXcopy;
+ infoRec->ScratchGC.planemask = ~0;
+
+ REGION_NULL(pScreen, &rgnDst);
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ REGION_TRANSLATE(pScreen, prgnSrc, -dx, -dy);
+ REGION_INTERSECT(pScreen, &rgnDst, &pWin->borderClip, prgnSrc);
+
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(nbox &&
+ (pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))) {
+
+ pbox = REGION_RECTS(&rgnDst);
+ for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ SWITCH_DEPTH(8);
+ XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+
+ if(pWin->drawable.bitsPerPixel != 8) {
+ SWITCH_DEPTH(pScrn->depth);
+ XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+ }
+
+ free(pptSrc);
+ }
+
+ REGION_UNINIT(pScreen, &rgnDst);
+
+ if(pWin->drawable.depth == 8) {
+ REGION_NULL(pScreen, &rgnDst);
+ miSegregateChildren(pWin, &rgnDst, pScrn->depth);
+ if(REGION_NOTEMPTY(pScreen, &rgnDst)) {
+ REGION_INTERSECT(pScreen, &rgnDst, &rgnDst, prgnSrc);
+ nbox = REGION_NUM_RECTS(&rgnDst);
+ if(nbox &&
+ (pptSrc = (DDXPointPtr )malloc(nbox * sizeof(DDXPointRec)))){
+
+ pbox = REGION_RECTS(&rgnDst);
+ for (i = nbox, ppt = pptSrc; i--; ppt++, pbox++) {
+ ppt->x = pbox->x1 + dx;
+ ppt->y = pbox->y1 + dy;
+ }
+
+ SWITCH_DEPTH(pScrn->depth);
+ XAADoBitBlt((DrawablePtr)pRoot, (DrawablePtr)pRoot,
+ &(infoRec->ScratchGC), &rgnDst, pptSrc);
+ free(pptSrc);
+ }
+ }
+ REGION_UNINIT(pScreen, &rgnDst);
+ }
+}
+
+
+void
+XAAOverWindowExposures(
+ WindowPtr pWin,
+ RegionPtr pReg,
+ RegionPtr pOtherReg
+){
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if((pWin->drawable.bitsPerPixel != 8) && infoRec->pScrn->vtSema) {
+ if(REGION_NUM_RECTS(pReg) && infoRec->FillSolidRects) {
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pScreen);
+
+ SWITCH_DEPTH(8);
+ (*infoRec->FillSolidRects)(infoRec->pScrn,
+ infoRec->pScrn->colorKey, GXcopy, ~0,
+ REGION_NUM_RECTS(pReg), REGION_RECTS(pReg));
+ miWindowExposures(pWin, pReg, pOtherReg);
+ return;
+ } else if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+ }
+
+ XAA_SCREEN_PROLOGUE (pScreen, WindowExposures);
+ (*pScreen->WindowExposures) (pWin, pReg, pOtherReg);
+ XAA_SCREEN_EPILOGUE(pScreen, WindowExposures, XAAOverWindowExposures);
+}
+
+/********************* Choosers *************************/
+
+static int
+XAAOverStippledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->StippledFillChooser)(pGC);
+
+ if((pGC->depth == 8) &&
+ ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+XAAOverOpaqueStippledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->OpaqueStippledFillChooser)(pGC);
+
+ if((pGC->depth == 8) &&
+ ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+static int
+XAAOverTiledFillChooser(GCPtr pGC)
+{
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+ int ret;
+
+ ret = (*pOverPriv->TiledFillChooser)(pGC);
+
+ if((pGC->depth == 8) &&
+ ((ret == DO_COLOR_8x8) || (ret == DO_CACHE_BLT))) {
+ ret = 0;
+ }
+
+ return ret;
+}
+
+
+/**************************** GC Functions **************************/
+
+static RegionPtr
+XAAOverCopyArea(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->CopyArea)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty);
+}
+
+static RegionPtr
+XAAOverCopyPlane(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx, int srcy,
+ int width, int height,
+ int dstx, int dsty,
+ unsigned long bitPlane
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->CopyPlane)(pSrc, pDst,
+ pGC, srcx, srcy, width, height, dstx, dsty, bitPlane);
+
+}
+
+static void
+XAAOverPushPixelsSolid(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDraw,
+ int dx, int dy,
+ int xOrg, int yOrg
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PushPixelsSolid)(pGC, pBitMap, pDraw, dx, dy, xOrg, yOrg);
+}
+
+
+
+static void
+XAAOverPolyFillRectSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectSolid)(pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectStippled)(pDraw, pGC, nrectFill, prectInit);
+}
+
+
+static void
+XAAOverPolyFillRectOpaqueStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectOpaqueStippled)(pDraw, pGC, nrectFill, prectInit);
+}
+
+static void
+XAAOverPolyFillRectTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillRectTiled)(pDraw, pGC, nrectFill, prectInit);
+}
+
+
+static void
+XAAOverFillSpansSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansSolid)(
+ pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+
+static void
+XAAOverFillSpansStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansStippled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static void
+XAAOverFillSpansOpaqueStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansOpaqueStippled)(
+ pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+
+static void
+XAAOverFillSpansTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nInit,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillSpansTiled)(pDraw, pGC, nInit, ppt, pwidth, fSorted);
+}
+
+static int
+XAAOverPolyText8TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText8TE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static int
+XAAOverPolyText16TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText16TE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static void
+XAAOverImageText8TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText8TE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static void
+XAAOverImageText16TE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText16TE)(pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageGlyphBltTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageGlyphBltTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAOverPolyGlyphBltTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyGlyphBltTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static int
+XAAOverPolyText8NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText8NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static int
+XAAOverPolyText16NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ return (*pOverPriv->PolyText16NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText8NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText8NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+static void
+XAAOverImageText16NonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageText16NonTE)(pDraw, pGC, x, y, count, chars);
+}
+
+
+static void
+XAAOverImageGlyphBltNonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->ImageGlyphBltNonTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAOverPolyGlyphBltNonTE(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyGlyphBltNonTE)(
+ pDraw, pGC, xInit, yInit, nglyph, ppci, pglyphBase);
+}
+
+static void
+XAAOverPolyRectangleThinSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyRectangleThinSolid)(pDraw, pGC, nRectsInit, pRectsInit);
+}
+
+
+
+static void
+XAAOverPolylinesWideSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesWideSolid)(pDraw, pGC, mode, npt, pPts);
+}
+
+
+static void
+XAAOverPolylinesThinSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesThinSolid)(pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolySegmentThinSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolySegmentThinSolid)(pDraw, pGC, nseg, pSeg);
+}
+
+static void
+XAAOverPolylinesThinDashed(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolylinesThinDashed)(pDraw, pGC, mode, npt, pPts);
+}
+
+static void
+XAAOverPolySegmentThinDashed(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolySegmentThinDashed)(pDraw, pGC, nseg, pSeg);
+}
+
+
+static void
+XAAOverFillPolygonSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonSolid)(pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverFillPolygonStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonStippled)(pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+
+static void
+XAAOverFillPolygonOpaqueStippled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonOpaqueStippled)(
+ pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+static void
+XAAOverFillPolygonTiled(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->FillPolygonTiled)(pDraw, pGC, shape, mode, count, ptsIn);
+}
+
+
+static void
+XAAOverPolyFillArcSolid(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int narcs,
+ xArc *parcs
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PolyFillArcSolid)(pDraw, pGC, narcs, parcs);
+}
+
+
+static void
+XAAOverPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+){
+ XAAOverlayPtr pOverPriv = GET_OVERLAY_PRIV(pGC->pScreen);
+
+ SWITCH_DEPTH(pGC->depth);
+
+ (*pOverPriv->PutImage)(pDraw, pGC, depth, x, y, w, h,
+ leftPad, format, pImage);
+}
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaPCache.c b/xorg-server/hw/xfree86/xaa/xaaPCache.c
index 7e3011bd5..62726d539 100644
--- a/xorg-server/hw/xfree86/xaa/xaaPCache.c
+++ b/xorg-server/hw/xfree86/xaa/xaaPCache.c
@@ -1,2380 +1,2380 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "gc.h"
-#include "mi.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "regionstr.h"
-#include "servermd.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaacexp.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-
-#define MAX_COLOR 32
-#define MAX_MONO 32
-#define MAX_8 32
-#define MAX_128 32
-#define MAX_256 32
-#define MAX_512 16
-
-static int CacheInitIndex = -1;
-#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val)
-
-
-typedef struct _CacheLink {
- int x;
- int y;
- int w;
- int h;
- struct _CacheLink *next;
-} CacheLink, *CacheLinkPtr;
-
-
-static void
-TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num)
-{
- while(num--) {
- array->x = list->x;
- array->y = list->y;
- array->w = list->w;
- array->h = list->h;
- array->serialNumber = 0;
- array->fg = array->bg = -1;
- list = list->next;
- array++;
- }
-}
-
-
-
-static CacheLinkPtr
-Enlist(CacheLinkPtr link, int x, int y, int w, int h)
-{
- CacheLinkPtr newLink;
-
- newLink = xalloc(sizeof(CacheLink));
- newLink->next = link;
- newLink->x = x; newLink->y = y;
- newLink->w = w; newLink->h = h;
- return newLink;
-}
-
-
-
-static CacheLinkPtr
-Delist(CacheLinkPtr link) {
- CacheLinkPtr ret = NULL;
-
- if(link) {
- ret = link->next;
- xfree(link);
- }
- return ret;
-}
-
-
-
-static void
-FreeList(CacheLinkPtr link) {
- CacheLinkPtr tmp;
-
- while(link) {
- tmp = link;
- link = link->next;
- xfree(tmp);
- }
-}
-
-
-
-static CacheLinkPtr
-QuadLinks(CacheLinkPtr big, CacheLinkPtr little)
-{
- /* CAUTION: This doesn't free big */
- int w1, w2, h1, h2;
-
- while(big) {
- w1 = big->w >> 1;
- w2 = big->w - w1;
- h1 = big->h >> 1;
- h2 = big->h - h1;
-
- little = Enlist(little, big->x, big->y, w1, h1);
- little = Enlist(little, big->x + w1, big->y, w2, h1);
- little = Enlist(little, big->x, big->y + h1, w1, h2);
- little = Enlist(little, big->x + w1, big->y + h1, w2, h2);
-
- big = big->next;
- }
- return little;
-}
-
-
-static void
-SubdivideList(CacheLinkPtr *large, CacheLinkPtr *small)
-{
- CacheLinkPtr big = *large;
- CacheLinkPtr little = *small;
- int size = big->w >> 1;
-
- little = Enlist(little, big->x, big->y, size, size);
- little = Enlist(little, big->x + size, big->y, size, size);
- little = Enlist(little, big->x, big->y + size, size, size);
- little = Enlist(little, big->x + size, big->y + size, size, size);
- *small = little;
- big = Delist(big);
- *large = big;
-}
-
-static void
-FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
-{
- if(!pPriv) return;
-
- if(pPriv->Info512)
- xfree(pPriv->Info512);
- if(pPriv->Info256)
- xfree(pPriv->Info256);
- if(pPriv->Info128)
- xfree(pPriv->Info128);
- if(pPriv->InfoColor)
- xfree(pPriv->InfoColor);
- if(pPriv->InfoMono)
- xfree(pPriv->InfoMono);
- if(pPriv->InfoPartial)
- xfree(pPriv->InfoPartial);
-
- xfree(pPriv);
-}
-
-void
-XAAClosePixmapCache(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
-
- if(infoRec->PixmapCachePrivate)
- FreePixmapCachePrivate(
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
-
- infoRec->PixmapCachePrivate = NULL;
-}
-
-
-
-static CacheLinkPtr
-ThinOutPartials(
- CacheLinkPtr ListPartial,
- int *num, int *maxw, int *maxh
-) {
-/* This guy's job is to get at least 4 big slots out of a list of fragments */
-
- CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
- int Num64, Num32, Num16, Num8, NumKeepers;
- int w, h;
-
- List64 = List32 = List16 = List8 = ListKeepers = NULL;
- Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
- w = h = 0;
-
- /* We sort partials by how large a square tile they can cache.
- If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile,
- we free it. */
-
- pCur = ListPartial;
- while(pCur) {
- next = pCur->next;
- if((pCur->w >= 64) && (pCur->h >= 64)) {
- pCur->next = List64; List64 = pCur;
- Num64++;
- } else
- if((pCur->w >= 32) && (pCur->h >= 32)) {
- pCur->next = List32; List32 = pCur;
- Num32++;
- } else
- if((pCur->w >= 16) && (pCur->h >= 16)) {
- pCur->next = List16; List16 = pCur;
- Num16++;
- } else
- if((pCur->w >= 8) && (pCur->h >= 8)) {
- pCur->next = List8; List8 = pCur;
- Num8++;
- } else {
- xfree(pCur);
- }
-
- pCur = next;
- }
-
- /* We save all the tiles from the largest bin that we can get
- at least 4 of. If there are too few of a bigger slot, we
- cut it in fourths to make smaller slots. */
-
- if(Num64 >= 4) {
- ListKeepers = List64; List64 = NULL;
- NumKeepers = Num64;
- goto GOT_EM;
- } else if(Num64) {
- List32 = QuadLinks(List64, List32);
- Num32 += Num64 * 4;
- Num64 = 0;
- }
-
- if(Num32 >= 4) {
- ListKeepers = List32; List32 = NULL;
- NumKeepers = Num32;
- goto GOT_EM;
- } else if(Num32) {
- List16 = QuadLinks(List32, List16);
- Num16 += Num32 * 4;
- Num32 = 0;
- }
-
- if(Num16 >= 4) {
- ListKeepers = List16; List16 = NULL;
- NumKeepers = Num16;
- goto GOT_EM;
- } else if(Num16) {
- List8 = QuadLinks(List16, List8);
- Num8 += Num16 * 4;
- Num16 = 0;
- }
-
- if(Num8 >= 4) {
- ListKeepers = List8; List8 = NULL;
- NumKeepers = Num8;
- goto GOT_EM;
- }
-
-GOT_EM:
-
- /* Free the ones we aren't using */
-
- if(List64) FreeList(List64);
- if(List32) FreeList(List32);
- if(List16) FreeList(List16);
- if(List8) FreeList(List8);
-
-
- /* Enlarge the slots if we can */
-
- if(ListKeepers) {
- CacheLinkPtr pLink = ListKeepers;
- w = h = 128;
-
- while(pLink) {
- if(pLink->w < w) w = pLink->w;
- if(pLink->h < h) h = pLink->h;
- pLink = pLink->next;
- }
- }
-
- *maxw = w;
- *maxh = h;
- *num = NumKeepers;
- return ListKeepers;
-}
-
-static void
-ConvertColorToMono(
- CacheLinkPtr *ColorList,
- int ColorW, int ColorH,
- CacheLinkPtr *MonoList,
- int MonoW, int MonoH
-){
- int x, y, w;
-
- x = (*ColorList)->x; y = (*ColorList)->y;
- *ColorList = Delist(*ColorList);
-
- while(ColorH) {
- ColorH -= MonoH;
- for(w = 0; w <= (ColorW - MonoW); w += MonoW)
- *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH);
- }
-}
-
-static void
-ConvertAllPartialsTo8x8(
- int *NumMono, int *NumColor,
- CacheLinkPtr ListPartial,
- CacheLinkPtr *ListMono,
- CacheLinkPtr *ListColor,
- XAAInfoRecPtr infoRec
-){
-/* This guy extracts as many 8x8 slots as it can out of fragments */
-
- int ColorH = infoRec->CacheHeightColor8x8Pattern;
- int ColorW = infoRec->CacheWidthColor8x8Pattern;
- int MonoH = infoRec->CacheHeightMono8x8Pattern;
- int MonoW = infoRec->CacheWidthMono8x8Pattern;
- int x, y, w, Height, Width;
- Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
- Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
- CacheLinkPtr pLink = ListPartial;
- CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
-
- if(DoColor && DoMono) {
- /* we assume color patterns take more space than color ones */
- if(MonoH > ColorH) ColorH = MonoH;
- if(MonoW > ColorW) ColorW = MonoW;
- }
-
- /* Break up the area into as many Color and Mono slots as we can */
-
- while(pLink) {
- Height = pLink->h;
- Width = pLink->w;
- x = pLink->x;
- y = pLink->y;
-
- if(DoColor) {
- while(Height >= ColorH) {
- Height -= ColorH;
- for(w = 0; w <= (Width - ColorW); w += ColorW) {
- ColorList = Enlist(
- ColorList, x + w, y + Height, ColorW, ColorH);
- (*NumColor)++;
- }
- }
- }
-
- if(DoMono && (Height >= MonoH)) {
- while(Height >= MonoH) {
- Height -= MonoH;
- for(w = 0; w <= (Width - MonoW); w += MonoW) {
- MonoList = Enlist(
- MonoList, x + w, y + Height, MonoW, MonoH);
- (*NumMono)++;
- }
- }
- }
-
- pLink = pLink->next;
- }
-
-
- *ListMono = MonoList;
- *ListColor = ColorList;
- FreeList(ListPartial);
-}
-
-
-static CacheLinkPtr
-ExtractOneThatFits(CacheLinkPtr *initList, int w, int h)
-{
- CacheLinkPtr list = *initList;
- CacheLinkPtr prev = NULL;
-
- while(list) {
- if((list->w >= w) && (list->h >= h))
- break;
- prev = list;
- list = list->next;
- }
-
- if(list) {
- if(prev)
- prev->next = list->next;
- else
- *initList = list->next;
-
- list->next = NULL;
- }
-
- return list;
-}
-
-
-static CacheLinkPtr
-ConvertSomePartialsTo8x8(
- int *NumMono, int *NumColor, int *NumPartial,
- CacheLinkPtr ListPartial,
- CacheLinkPtr *ListMono,
- CacheLinkPtr *ListColor,
- int *maxw, int *maxh,
- XAAInfoRecPtr infoRec
-){
-/* This guy tries to get 4 of each type of 8x8 slot requested out of
- a list of fragments all while trying to retain some big fragments
- for the cache blits */
-
- int ColorH = infoRec->CacheHeightColor8x8Pattern;
- int ColorW = infoRec->CacheWidthColor8x8Pattern;
- int MonoH = infoRec->CacheHeightMono8x8Pattern;
- int MonoW = infoRec->CacheWidthMono8x8Pattern;
- Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
- Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
- CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
- CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
- int Num64, Num32, Num16, Num8, NumKeepers;
- int w, h, Width, Height;
- int MonosPerColor = 1;
-
- if(DoColor && DoMono) {
- /* we assume color patterns take more space than color ones */
- if(MonoH > ColorH) ColorH = MonoH;
- if(MonoW > ColorW) ColorW = MonoW;
- MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
- }
-
- List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList = NULL;
- Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
- Width = Height = 0;
-
- /* We sort partials by how large a square tile they can cache.
- We make 8x8 patterns from the leftovers if we can. */
-
- pCur = ListPartial;
- while(pCur) {
- next = pCur->next;
- if((pCur->w >= 64) && (pCur->h >= 64)) {
- pCur->next = List64; List64 = pCur;
- Num64++;
- } else
- if((pCur->w >= 32) && (pCur->h >= 32)) {
- pCur->next = List32; List32 = pCur;
- Num32++;
- } else
- if((pCur->w >= 16) && (pCur->h >= 16)) {
- pCur->next = List16; List16 = pCur;
- Num16++;
- } else
- if((pCur->w >= 8) && (pCur->h >= 8)) {
- pCur->next = List8; List8 = pCur;
- Num8++;
- } else {
- h = pCur->h;
- if(DoColor && (pCur->w >= ColorW) && (h >= ColorH)) {
- while(h >= ColorH) {
- h -= ColorH;
- for(w = 0; w <= (pCur->w - ColorW); w += ColorW) {
- ColorList = Enlist( ColorList,
- pCur->x + w, pCur->y + h, ColorW, ColorH);
- (*NumColor)++;
- }
- }
- }
- if(DoMono && (pCur->w >= MonoW) && (h >= MonoH)) {
- while(h >= MonoH) {
- h -= MonoH;
- for(w = 0; w <= (pCur->w - MonoW); w += MonoW) {
- MonoList = Enlist( MonoList,
- pCur->x + w, pCur->y + h, MonoW, MonoH);
- (*NumMono)++;
- }
- }
- }
- xfree(pCur);
- }
-
- pCur = next;
- }
-
- /* Try to extract at least 4 of each type of 8x8 slot that we need */
-
- if(DoColor) {
- CacheLinkPtr theOne;
- while(*NumColor < 4) {
- theOne = NULL;
- if(Num8) {
- if((theOne = ExtractOneThatFits(&List8, ColorW, ColorH)))
- Num8--;
- }
- if(Num16 && !theOne) {
- if((theOne = ExtractOneThatFits(&List16, ColorW, ColorH)))
- Num16--;
- }
- if(Num32 && !theOne) {
- if((theOne = ExtractOneThatFits(&List32, ColorW, ColorH)))
- Num32--;
- }
- if(Num64 && !theOne) {
- if((theOne = ExtractOneThatFits(&List64, ColorW, ColorH)))
- Num64--;
- }
-
- if(!theOne) break;
-
-
- ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
- &MonoList, &ColorList, infoRec);
-
- if(DoMono) {
- while(*NumColor && (*NumMono < 4)) {
- ConvertColorToMono(&ColorList, ColorW, ColorH,
- &MonoList, MonoW, MonoH);
- (*NumColor)--; *NumMono += MonosPerColor;
- }
- }
- }
- }
-
- if(DoMono) {
- CacheLinkPtr theOne;
- while(*NumMono < 4) {
- theOne = NULL;
- if(Num8) {
- if((theOne = ExtractOneThatFits(&List8, MonoW, MonoH)))
- Num8--;
- }
- if(Num16 && !theOne) {
- if((theOne = ExtractOneThatFits(&List16, MonoW, MonoH)))
- Num16--;
- }
- if(Num32 && !theOne) {
- if((theOne = ExtractOneThatFits(&List32, MonoW, MonoH)))
- Num32--;
- }
- if(Num64 && !theOne) {
- if((theOne = ExtractOneThatFits(&List64, MonoW, MonoH)))
- Num64--;
- }
-
- if(!theOne) break;
-
- ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
- &MonoList, &ColorList, infoRec);
- }
- }
-
- /* We save all the tiles from the largest bin that we can get
- at least 4 of. If there are too few of a bigger slot, we
- cut it in fourths to make smaller slots. */
-
- if(Num64 >= 4) {
- ListKeepers = List64; List64 = NULL;
- NumKeepers = Num64;
- goto GOT_EM;
- } else if(Num64) {
- List32 = QuadLinks(List64, List32);
- Num32 += Num64 * 4;
- Num64 = 0;
- }
-
- if(Num32 >= 4) {
- ListKeepers = List32; List32 = NULL;
- NumKeepers = Num32;
- goto GOT_EM;
- } else if(Num32) {
- List16 = QuadLinks(List32, List16);
- Num16 += Num32 * 4;
- Num32 = 0;
- }
-
- if(Num16 >= 4) {
- ListKeepers = List16; List16 = NULL;
- NumKeepers = Num16;
- goto GOT_EM;
- } else if(Num16) {
- List8 = QuadLinks(List16, List8);
- Num8 += Num16 * 4;
- Num16 = 0;
- }
-
- if(Num8 >= 4) {
- ListKeepers = List8; List8 = NULL;
- NumKeepers = Num8;
- goto GOT_EM;
- }
-
-GOT_EM:
-
- /* Free the ones we aren't using */
-
- if(List64)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List64,
- &MonoList, &ColorList, infoRec);
- if(List32)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List32,
- &MonoList, &ColorList, infoRec);
- if(List16)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List16,
- &MonoList, &ColorList, infoRec);
- if(List8)
- ConvertAllPartialsTo8x8(NumMono, NumColor, List8,
- &MonoList, &ColorList, infoRec);
-
-
- /* Enlarge the slots if we can */
-
- if(ListKeepers) {
- CacheLinkPtr pLink = ListKeepers;
- Width = Height = 128;
-
- while(pLink) {
- if(pLink->w < Width) Width = pLink->w;
- if(pLink->h < Height) Height = pLink->h;
- pLink = pLink->next;
- }
- }
-
- *ListMono = MonoList;
- *ListColor = ColorList;
- *maxw = Width;
- *maxh = Height;
- *NumPartial = NumKeepers;
- return ListKeepers;
-}
-
-
-void
-XAAInitPixmapCache(
- ScreenPtr pScreen,
- RegionPtr areas,
- pointer data
-) {
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAInfoRecPtr infoRec = (XAAInfoRecPtr)data;
- XAAPixmapCachePrivatePtr pCachePriv;
- BoxPtr pBox = REGION_RECTS(areas);
- int nBox = REGION_NUM_RECTS(areas);
- int Num512, Num256, Num128, NumPartial, NumColor, NumMono;
- int Target512, Target256;
- CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono;
- int x, y, w, h, ntotal, granularity, width, height, i;
- int MaxPartialWidth, MaxPartialHeight;
-
- infoRec->MaxCacheableTileWidth = 0;
- infoRec->MaxCacheableTileHeight = 0;
- infoRec->MaxCacheableStippleHeight = 0;
- infoRec->MaxCacheableStippleWidth = 0;
- infoRec->UsingPixmapCache = FALSE;
-
-
- if(!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE))
- return;
-
- /* Allocate a persistent per-screen init flag to control messages */
- if (CacheInitIndex < 0)
- CacheInitIndex = xf86AllocateScrnInfoPrivateIndex();
-
- /* free the old private data if it exists */
- if(infoRec->PixmapCachePrivate) {
- FreePixmapCachePrivate(
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
- infoRec->PixmapCachePrivate = NULL;
- }
-
- Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0;
- List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL;
- granularity = infoRec->CachePixelGranularity;
- if(granularity <= 1) granularity = 0;
-
- /* go through the boxes and break it into as many pieces as we can fit */
-
- while(nBox--) {
- x = pBox->x1;
- if(granularity) {
- int tmp = x % granularity;
- if(tmp) x += (granularity - tmp);
- }
- width = pBox->x2 - x;
- if(width <= 0) {pBox++; continue;}
-
- y = pBox->y1;
- height = pBox->y2 - y;
-
- for(h = 0; h <= (height - 512); h += 512) {
- for(w = 0; w <= (width - 512); w += 512) {
- List512 = Enlist(List512, x + w, y + h, 512, 512);
- Num512++;
- }
- for(; w <= (width - 256); w += 256) {
- List256 = Enlist(List256, x + w, y + h, 256, 256);
- List256 = Enlist(List256, x + w, y + h + 256, 256, 256);
- Num256 += 2;
- }
- for(; w <= (width - 128); w += 128) {
- List128 = Enlist(List128, x + w, y + h, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 256, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 384, 128, 128);
- Num128 += 4;
- }
- if(w < width) {
- int d = width - w;
- ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128);
- NumPartial += 4;
- }
- }
- for(; h <= (height - 256); h += 256) {
- for(w = 0; w <= (width - 256); w += 256) {
- List256 = Enlist(List256, x + w, y + h, 256, 256);
- Num256++;
- }
- for(; w <= (width - 128); w += 128) {
- List128 = Enlist(List128, x + w, y + h, 128, 128);
- List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
- Num128 += 2;
- }
- if(w < width) {
- int d = width - w;
- ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
- ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
- NumPartial += 2;
- }
- }
- for(; h <= (height - 128); h += 128) {
- for(w = 0; w <= (width - 128); w += 128) {
- List128 = Enlist(List128, x + w, y + h, 128, 128);
- Num128++;
- }
- if(w < width) {
- ListPartial = Enlist(
- ListPartial, x + w, y + h, width - w, 128);
- NumPartial++;
- }
- }
- if(h < height) {
- int d = height - h;
- for(w = 0; w <= (width - 128); w += 128) {
- ListPartial = Enlist(ListPartial, x + w, y + h, 128, d);
- NumPartial++;
- }
- if(w < width) {
- ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d);
- NumPartial++;
- }
- }
- pBox++;
- }
-
-
-/*
- by this point we've carved the space into as many 512x512, 256x256
- and 128x128 blocks as we could fit. We will then break larger
- blocks into smaller ones if we need to. The rules are as follows:
-
- 512x512 -
- 1) Don't take up more than half the memory.
- 2) Don't bother if you can't get at least four.
- 3) Don't make more than MAX_512.
- 4) Don't have any of there are no 256x256s.
-
- 256x256 -
- 1) Don't take up more than a quarter of the memory enless there
- aren't any 512x512s. Then we can take up to half.
- 2) Don't bother if you can't get at least four.
- 3) Don't make more than MAX_256.
-
- 128x128 -
- 1) Don't make more than MAX_128.
-
- We don't bother with the partial blocks unless we can use them
- for 8x8 pattern fills or we are short on larger blocks.
-
-*/
-
- ntotal = Num128 + (Num256<<2) + (Num512<<4);
-
- Target512 = ntotal >> 5;
- if(Target512 < 4) Target512 = 0;
- if(!Target512) Target256 = ntotal >> 3;
- else Target256 = ntotal >> 4;
- if(Target256 < 4) Target256 = 0;
-
- if(Num512 && Num256 < 4) {
- while(Num512 && Num256 < Target256) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- }
- }
-
- if(!Num512) { /* no room */
- } else if((Num512 < 4) || (!Target512)) {
- while(Num512) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- }
- } else if((Num512 > MAX_512) || (Num512 > Target512)){
- while(Num512 > MAX_512) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- }
- while(Num512 > Target512) {
- if(Num256 < MAX_256) {
- SubdivideList(&List512, &List256);
- Num256 += 4; Num512--;
- } else break;
- }
- }
-
- if(!Num256) { /* no room */
- } else if((Num256 < 4) || (!Target256)) {
- while(Num256) {
- SubdivideList(&List256, &List128);
- Num128 += 4; Num256--;
- }
- } else if((Num256 > MAX_256) || (Num256 > Target256)) {
- while(Num256 > MAX_256) {
- SubdivideList(&List256, &List128);
- Num128 += 4; Num256--;
- }
- while(Num256 > Target256) {
- if(Num128 < MAX_128) {
- SubdivideList(&List256, &List128);
- Num128 += 4; Num256--;
- } else break;
- }
- }
-
- if(Num128 && ((Num128 < 4) || (Num128 > MAX_128))) {
- CacheLinkPtr next;
- int max = (Num128 > MAX_128) ? MAX_128 : 0;
-
- /*
- * Note: next is set in this way to work around a code generation
- * bug in gcc 2.7.2.3.
- */
- next = List128->next;
- while(Num128 > max) {
- List128->next = ListPartial;
- ListPartial = List128;
- if((List128 = next))
- next = List128->next;
- NumPartial++; Num128--;
- }
- }
-
- MaxPartialHeight = MaxPartialWidth = 0;
-
- /* at this point we have as many 512x512 and 256x256 slots as we
- want but may have an excess of 128x128 slots. We still need
- to find out if we need 8x8 slots. We take these from the
- partials if we have them. Otherwise, we break some 128x128's */
-
- if(!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) {
- if(NumPartial) {
- if(Num128) { /* don't bother with partials */
- FreeList(ListPartial);
- NumPartial = 0; ListPartial = NULL;
- } else {
- /* We have no big slots. Weed out the unusable partials */
- ListPartial = ThinOutPartials(ListPartial, &NumPartial,
- &MaxPartialWidth, &MaxPartialHeight);
- }
- }
- } else {
- int MonosPerColor = 1;
- int ColorH = infoRec->CacheHeightColor8x8Pattern;
- int ColorW = infoRec->CacheWidthColor8x8Pattern;
- int MonoH = infoRec->CacheHeightMono8x8Pattern;
- int MonoW = infoRec->CacheWidthMono8x8Pattern;
- Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
- Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
-
- if(DoColor) infoRec->CanDoColor8x8 = FALSE;
- if(DoMono) infoRec->CanDoMono8x8 = FALSE;
-
- if(DoColor && DoMono) {
- /* we assume color patterns take more space than color ones */
- if(MonoH > ColorH) ColorH = MonoH;
- if(MonoW > ColorW) ColorW = MonoW;
- MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
- }
-
- if(Num128) {
- if(NumPartial) { /* use all for 8x8 slots */
- ConvertAllPartialsTo8x8(&NumMono, &NumColor,
- ListPartial, &ListMono, &ListColor, infoRec);
- NumPartial = 0; ListPartial = NULL;
- }
-
- /* Get some 8x8 slots from the 128 slots */
- while((Num128 > 4) &&
- ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) {
- CacheLinkPtr tmp = NULL;
-
- tmp = Enlist(tmp, List128->x, List128->y,
- List128->w, List128->h);
- List128 = Delist(List128);
- Num128--;
-
- ConvertAllPartialsTo8x8(&NumMono, &NumColor,
- tmp, &ListMono, &ListColor, infoRec);
- }
- } else if(NumPartial) {
- /* We have share partials between 8x8 slots and tiles. */
- ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor,
- &NumPartial, ListPartial, &ListMono, &ListColor,
- &MaxPartialWidth, &MaxPartialHeight, infoRec);
- }
-
-
- if(DoMono && DoColor) {
- if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
- int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
-
- while(NumColor > max) {
- ConvertColorToMono(&ListColor, ColorW, ColorH,
- &ListMono, MonoW, MonoH);
- NumColor--; NumMono += MonosPerColor;
- }
- }
-
- /* favor Mono slots over Color ones */
- while((NumColor > 4) && (NumMono < MAX_MONO)) {
- ConvertColorToMono(&ListColor, ColorW, ColorH,
- &ListMono, MonoW, MonoH);
- NumColor--; NumMono += MonosPerColor;
- }
- }
-
- if(NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) {
- int max = (NumMono > MAX_MONO) ? MAX_MONO : 0;
-
- while(NumMono > max) {
- ListMono = Delist(ListMono);
- NumMono--;
- }
- }
- if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
- int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
-
- while(NumColor > max) {
- ListColor = Delist(ListColor);
- NumColor--;
- }
- }
- }
-
-
- pCachePriv = xcalloc(1,sizeof(XAAPixmapCachePrivate));
- if(!pCachePriv) {
- if(Num512) FreeList(List512);
- if(Num256) FreeList(List256);
- if(Num128) FreeList(List128);
- if(NumPartial) FreeList(ListPartial);
- if(NumColor) FreeList(ListColor);
- if(NumMono) FreeList(ListMono);
- return;
- }
-
- infoRec->PixmapCachePrivate = (char*)pCachePriv;
-
- if(Num512) {
- pCachePriv->Info512 = xcalloc(Num512,sizeof(XAACacheInfoRec));
- if(!pCachePriv->Info512) Num512 = 0;
- if(Num512) TransferList(List512, pCachePriv->Info512, Num512);
- FreeList(List512);
- pCachePriv->Num512x512 = Num512;
- }
- if(Num256) {
- pCachePriv->Info256 = xcalloc(Num256, sizeof(XAACacheInfoRec));
- if(!pCachePriv->Info256) Num256 = 0;
- if(Num256) TransferList(List256, pCachePriv->Info256, Num256);
- FreeList(List256);
- pCachePriv->Num256x256 = Num256;
- }
- if(Num128) {
- pCachePriv->Info128 = xcalloc(Num128, sizeof(XAACacheInfoRec));
- if(!pCachePriv->Info128) Num128 = 0;
- if(Num128) TransferList(List128, pCachePriv->Info128, Num128);
- FreeList(List128);
- pCachePriv->Num128x128 = Num128;
- }
-
- if(NumPartial) {
- pCachePriv->InfoPartial = xcalloc(NumPartial, sizeof(XAACacheInfoRec));
- if(!pCachePriv->InfoPartial) NumPartial = 0;
- if(NumPartial)
- TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
- FreeList(ListPartial);
- pCachePriv->NumPartial = NumPartial;
- }
-
- if(NumColor) {
- pCachePriv->InfoColor = xcalloc(NumColor, sizeof(XAACacheInfoRec));
- if(!pCachePriv->InfoColor) NumColor = 0;
- if(NumColor) TransferList(ListColor, pCachePriv->InfoColor, NumColor);
- FreeList(ListColor);
- pCachePriv->NumColor = NumColor;
- }
-
- if(NumMono) {
- pCachePriv->InfoMono = xcalloc(NumMono, sizeof(XAACacheInfoRec));
- if(!pCachePriv->InfoMono) NumMono = 0;
- if(NumMono) TransferList(ListMono, pCachePriv->InfoMono, NumMono);
- FreeList(ListMono);
- pCachePriv->NumMono = NumMono;
- }
-
-
- if(NumPartial) {
- infoRec->MaxCacheableTileWidth = MaxPartialWidth;
- infoRec->MaxCacheableTileHeight = MaxPartialHeight;
- }
- if(Num128)
- infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128;
- if(Num256)
- infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256;
- if(Num512)
- infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512;
-
-
- infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight;
- infoRec->MaxCacheableStippleWidth =
- infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel;
- if(infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP)
- infoRec->MaxCacheableStippleWidth /= 3;
-
- if(NumMono) {
- if(!(infoRec->Mono8x8PatternFillFlags &
- (HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
- HARDWARE_PATTERN_PROGRAMMED_BITS))) {
- int numPerLine =
- infoRec->CacheWidthMono8x8Pattern/infoRec->MonoPatternPitch;
-
- for(i = 0; i < 64; i++) {
- pCachePriv->MonoOffsets[i].y = i/numPerLine;
- pCachePriv->MonoOffsets[i].x = (i % numPerLine) *
- infoRec->MonoPatternPitch;
- }
- }
- infoRec->CanDoMono8x8 = TRUE;
- }
- if(NumColor) {
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
-
- for(i = 0; i < 64; i++) {
- pCachePriv->ColorOffsets[i].y = i & 0x07;
- pCachePriv->ColorOffsets[i].x = i & ~0x07;
- }
- }
- infoRec->CanDoColor8x8 = TRUE;
- }
-
- if(!CACHEINIT(pScrn)) {
- xf86ErrorF("\tSetting up tile and stipple cache:\n");
- if(NumPartial)
- xf86ErrorF("\t\t%i %ix%i slots\n",
- NumPartial, MaxPartialWidth, MaxPartialHeight);
- if(Num128) xf86ErrorF("\t\t%i 128x128 slots\n", Num128);
- if(Num256) xf86ErrorF("\t\t%i 256x256 slots\n", Num256);
- if(Num512) xf86ErrorF("\t\t%i 512x512 slots\n", Num512);
- if(NumColor) xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor);
- if(NumMono) xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono);
- }
-
- if(!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) {
- if(!CACHEINIT(pScrn))
- xf86ErrorF("\t\tNot enough video memory for pixmap cache\n");
- } else infoRec->UsingPixmapCache = TRUE;
-
- CACHEINIT(pScrn) = 1;
-}
-
-#if X_BYTE_ORDER == X_BIG_ENDIAN
-static CARD32 StippleMasks[4] = {
- 0x80808080,
- 0xC0C0C0C0,
- 0x00000000,
- 0xF0F0F0F0
-};
-#else
-static CARD32 StippleMasks[4] = {
- 0x01010101,
- 0x03030303,
- 0x00000000,
- 0x0F0F0F0F
-};
-#endif
-
-Bool
-XAACheckStippleReducibility(PixmapPtr pPixmap)
-{
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
- CARD32 *IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- int w = pPixmap->drawable.width;
- int h = pPixmap->drawable.height;
- int i;
- CARD32 bits[8];
- CARD32 mask = SHIFT_R(0xFFFFFFFF,24);
-
- pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR;
- pPriv->flags &= ~REDUCIBLE_TO_8x8;
-
- if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
- return FALSE;
-
- i = (h > 8) ? 8 : h;
-
- switch(w) {
- case 32:
- while(i--) {
- bits[i] = IntPtr[i] & mask;
- if( (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) ||
- (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,16)),16)) ||
- (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,24)),24)))
- return FALSE;
- }
- break;
- case 16:
- while(i--) {
- bits[i] = IntPtr[i] & mask;
- if(bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask,8),8))))
- return FALSE;
- }
- break;
- default:
- while(i--)
- bits[i] = IntPtr[i] & mask;
- break;
- }
-
- switch(h) {
- case 32:
- if( (IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) ||
- (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) ||
- (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) ||
- (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) ||
- (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) ||
- (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) ||
- (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) ||
- (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31]))
- return FALSE;
- /* fall through */
- case 16:
- if( (IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) ||
- (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) ||
- (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) ||
- (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15]))
- return FALSE;
- case 8: break;
- case 1: bits[1] = bits[0];
- case 2: bits[2] = bits[0]; bits[3] = bits[1];
- case 4: bits[4] = bits[0]; bits[5] = bits[1];
- bits[6] = bits[2]; bits[7] = bits[3];
- break;
- }
-
- pPriv->flags |= REDUCIBLE_TO_8x8;
-
- pPriv->pattern0 = bits[0] | SHIFT_L(bits[1],8) | SHIFT_L(bits[2],16) | SHIFT_L(bits[3],24);
- pPriv->pattern1 = bits[4] | SHIFT_L(bits[5],8) | SHIFT_L(bits[6],16) | SHIFT_L(bits[7],24);
-
- if(w < 8) {
- pPriv->pattern0 &= StippleMasks[w - 1];
- pPriv->pattern1 &= StippleMasks[w - 1];
-
- switch(w) {
- case 1: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,1);
- pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,1);
- case 2: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,2);
- pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,2);
- case 4: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,4);
- pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,4);
- }
- }
-
- if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
- pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
- }
-
-
- return TRUE;
-}
-
-
-Bool
-XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono)
-{
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
- CARD32 *IntPtr;
- int w = pPixmap->drawable.width;
- int h = pPixmap->drawable.height;
- int pitch = pPixmap->devKind >> 2;
- int dwords, i, j;
-
- pPriv->flags |= REDUCIBILITY_CHECKED;
- pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR);
-
- if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
- return FALSE;
-
- dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5;
- i = (h > 8) ? 8 : h;
-
-
- if(w > 8) {
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- switch(pPixmap->drawable.bitsPerPixel) {
- case 8:
- while(i--) {
- for(j = 2; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j & 0x01])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- case 16:
- while(i--) {
- for(j = 4; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j & 0x03])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- case 24:
- while(i--) {
- for(j = 6; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j % 6])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- case 32:
- while(i--) {
- for(j = 8; j < dwords; j++)
- if(IntPtr[j] != IntPtr[j & 0x07])
- return FALSE;
- IntPtr += pitch;
- }
- break;
- default: return FALSE;
- }
-
- }
-
-
- if(h == 32) {
- CARD32 *IntPtr2, *IntPtr3, *IntPtr4;
- i = 8;
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- IntPtr2 = IntPtr + (pitch << 3);
- IntPtr3 = IntPtr2 + (pitch << 3);
- IntPtr4 = IntPtr3 + (pitch << 3);
- while(i--) {
- for(j = 0; j < dwords; j++)
- if((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) ||
- (IntPtr[j] != IntPtr4[j]))
- return FALSE;
- IntPtr += pitch;
- IntPtr2 += pitch;
- IntPtr3 += pitch;
- IntPtr4 += pitch;
- }
- } else if (h == 16) {
- CARD32 *IntPtr2;
- i = 8;
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- IntPtr2 = IntPtr + (pitch << 3);
- while(i--) {
- for(j = 0; j < dwords; j++)
- if(IntPtr[j] != IntPtr2[j])
- return FALSE;
- IntPtr += pitch;
- IntPtr2 += pitch;
- }
- }
-
- pPriv->flags |= REDUCIBLE_TO_8x8;
-
- if(checkMono) {
- XAAInfoRecPtr infoRec =
- GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
- unsigned char bits[8];
- int fg, bg = -1, x, y;
-
- i = (h > 8) ? 8 : h;
- j = (w > 8) ? 8 : w;
-
- if(pPixmap->drawable.bitsPerPixel == 8) {
- unsigned char *srcp = pPixmap->devPrivate.ptr;
- fg = srcp[0];
- pitch = pPixmap->devKind;
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x++) {
- if(srcp[x] != fg) {
- if(bg == -1) bg = srcp[x];
- else if(bg != srcp[x]) return TRUE;
- } else bits[y] |= 1 << x;
- }
- srcp += pitch;
- }
- } else if(pPixmap->drawable.bitsPerPixel == 16) {
- unsigned short *srcp = (unsigned short*)pPixmap->devPrivate.ptr;
- fg = srcp[0];
- pitch = pPixmap->devKind >> 1;
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x++) {
- if(srcp[x] != fg) {
- if(bg == -1) bg = srcp[x];
- else if(bg != srcp[x]) return TRUE;
- } else bits[y] |= 1 << x;
- }
- srcp += pitch;
- }
- } else if(pPixmap->drawable.bitsPerPixel == 24) {
- CARD32 val;
- unsigned char *srcp = pPixmap->devPrivate.ptr;
- fg = *((CARD32*)srcp) & 0x00FFFFFF;
- pitch = pPixmap->devKind;
- j *= 3;
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x+=3) {
- val = *((CARD32*)(srcp+x)) & 0x00FFFFFF;
- if(val != fg) {
- if(bg == -1) bg = val;
- else if(bg != val)
- return TRUE;
- } else bits[y] |= 1 << (x/3);
- }
- srcp += pitch;
- }
- } else if(pPixmap->drawable.bitsPerPixel == 32) {
- IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
- fg = IntPtr[0];
- for(y = 0; y < i; y++) {
- bits[y] = 0;
- for(x = 0; x < j; x++) {
- if(IntPtr[x] != fg) {
- if(bg == -1) bg = IntPtr[x];
- else if(bg != IntPtr[x]) return TRUE;
- } else bits[y] |= 1 << x;
- }
- IntPtr += pitch;
- }
- } else return TRUE;
-
- pPriv->fg = fg;
- if(bg == -1) pPriv->bg = fg;
- else pPriv->bg = bg;
-
- if(h < 8) {
- switch(h) {
- case 1: bits[1] = bits[0];
- case 2: bits[2] = bits[0]; bits[3] = bits[1];
- case 4: bits[4] = bits[0]; bits[5] = bits[1];
- bits[6] = bits[2]; bits[7] = bits[3];
- break;
- }
- }
-
- pPriv->pattern0 =
- bits[0] | (bits[1]<<8) | (bits[2]<<16) | (bits[3]<<24);
- pPriv->pattern1 =
- bits[4] | (bits[5]<<8) | (bits[6]<<16) | (bits[7]<<24);
-
- if(w < 8) {
- switch(w) {
- case 1: pPriv->pattern0 |= (pPriv->pattern0 << 1);
- pPriv->pattern1 |= (pPriv->pattern1 << 1);
- case 2: pPriv->pattern0 |= (pPriv->pattern0 << 2);
- pPriv->pattern1 |= (pPriv->pattern1 << 2);
- case 4: pPriv->pattern0 |= (pPriv->pattern0 << 4);
- pPriv->pattern1 |= (pPriv->pattern1 << 4);
- }
- }
- pPriv->flags |= REDUCIBLE_TO_2_COLOR;
-
- if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
- pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
- pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
- }
-
- }
-
- return TRUE;
-}
-
-
-void XAATileCache(
- ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache,
- int w, int h
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, GXcopy, ~0, -1);
-
- while((w << 1) <= pCache->w) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x + w, pCache->y, w, h);
- w <<= 1;
- }
- if(w != pCache->w) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x + w, pCache->y, pCache->w - w, h);
- w = pCache->w;
- }
-
- while((h << 1) <= pCache->h) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x, pCache->y + h, w, h);
- h <<= 1;
- }
- if(h != pCache->h) {
- (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
- pCache->x, pCache->y + h, w, pCache->h - h);
- }
- SET_SYNC_FLAG(infoRec);
-}
-
-XAACacheInfoPtr
-XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- int size = max(w, h);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0;
- int *current;
-
- if(size <= 128) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if(size <= 256) {
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if(size <= 512) {
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACacheTile()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
-
- /* lets look for it */
- for(i = 0; i < max; i++, pCache++) {
- if(pCache->serialNumber == pPix->drawable.serialNumber) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->bg = pCache->fg = -1;
- pCache->orig_w = w; pCache->orig_h = h;
- (*infoRec->WritePixmapToCache)(
- pScrn, pCache->x, pCache->y, w, h, pPix->devPrivate.ptr,
- pPix->devKind, pPix->drawable.bitsPerPixel, pPix->drawable.depth);
- if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
- ((w != pCache->w) || (h != pCache->h)))
- XAATileCache(pScrn, pCache, w, h);
-
- return pCache;
-}
-
-XAACacheInfoPtr
-XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel;
- int *current;
- StippleScanlineProcPtr StippleFunc;
- unsigned char *data, *srcPtr, *dstPtr;
-
- if((h <= 128) && (w <= 128 * bpp)) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if((h <= 256) && (w <= 256 * bpp)){
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if((h <= 512) && (w <= 526 * bpp)){
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACacheMonoStipple()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
-
- /* lets look for it */
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (pCache->fg == -1) && (pCache->bg == -1)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->bg = pCache->fg = -1;
- pCache->orig_w = w; pCache->orig_h = h;
-
- if(w <= 32) {
- if(w & (w - 1)) funcNo = 1;
- else funcNo = 0;
- } else funcNo = 2;
-
- pad = BitmapBytePad(pCache->w * bpp);
- dwords = bytes_to_int32(pad);
- dstPtr = data = (unsigned char*)xalloc(pad * pCache->h);
- srcPtr = (unsigned char*)pPix->devPrivate.ptr;
-
- if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
- StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo];
- else
- StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo];
-
- /* don't bother generating more than we'll ever use */
- max = ((pScrn->displayWidth + w - 1) + 31) >> 5;
- if(dwords > max)
- dwords = max;
-
- for(i = 0; i < h; i++) {
- (*StippleFunc)((CARD32*)dstPtr, (CARD32*)srcPtr, 0, w, dwords);
- srcPtr += pPix->devKind;
- dstPtr += pad;
- }
-
- while((h<<1) <= pCache->h) {
- memcpy(data + (pad * h), data, pad * h);
- h <<= 1;
- }
-
- if(h < pCache->h)
- memcpy(data + (pad * h), data, pad * (pCache->h - h));
-
- (*infoRec->WritePixmapToCache)(
- pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data,
- pad, bpp, pScrn->depth);
-
- xfree(data);
-
- return pCache;
-}
-
-XAACacheInfoPtr
-XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0;
- int *current;
-
- if((h <= 128) && (w <= 128)) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if((h <= 256) && (w <= 256)){
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if((h <= 512) && (w <= 526)){
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
-
- /* lets look for it */
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (pCache->fg == -1) && (pCache->bg == -1)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->bg = pCache->fg = -1;
- pCache->orig_w = w; pCache->orig_h = h;
-
- /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */
- (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
- pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
- pPix->devKind, 1, 2);
- if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) &&
- ((w != pCache->w) || (h != pCache->h)))
- XAATileCache(pScrn, pCache, w, h);
-
- return pCache;
-}
-
-XAACachePlanarMonoStippleProc
-XAAGetCachePlanarMonoStipple(void)
-{
- return XAACachePlanarMonoStipple;
-}
-
-XAACacheInfoPtr
-XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
-{
- int w = pPix->drawable.width;
- int h = pPix->drawable.height;
- int size = max(w, h);
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache, cacheRoot = NULL;
- int i, max = 0;
- int *current;
-
- if(size <= 128) {
- if(pCachePriv->Info128) {
- cacheRoot = pCachePriv->Info128;
- max = pCachePriv->Num128x128;
- current = &pCachePriv->Current128;
- } else {
- cacheRoot = pCachePriv->InfoPartial;
- max = pCachePriv->NumPartial;
- current = &pCachePriv->CurrentPartial;
- }
- } else if(size <= 256) {
- cacheRoot = pCachePriv->Info256;
- max = pCachePriv->Num256x256;
- current = &pCachePriv->Current256;
- } else if(size <= 512) {
- cacheRoot = pCachePriv->Info512;
- max = pCachePriv->Num512x512;
- current = &pCachePriv->Current512;
- } else { /* something's wrong */
- ErrorF("Something's wrong in XAACacheStipple()\n");
- return pCachePriv->Info128;
- }
-
- pCache = cacheRoot;
- /* lets look for it */
- if(bg == -1)
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (fg == pCache->fg) && (pCache->fg != pCache->bg)) {
- pCache->trans_color = pCache->bg;
- return pCache;
- }
- }
- else
- for(i = 0; i < max; i++, pCache++) {
- if((pCache->serialNumber == pPix->drawable.serialNumber) &&
- (fg == pCache->fg) && (bg == pCache->bg)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
-
- pCache = &cacheRoot[(*current)++];
- if(*current >= max) *current = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->fg = fg;
- if(bg == -1)
- pCache->trans_color = bg = fg ^ 1;
- else
- pCache->trans_color = -1;
- pCache->bg = bg;
-
- pCache->orig_w = w; pCache->orig_h = h;
- (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
- pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
- pPix->devKind, fg, bg);
- if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
- ((w != pCache->w) || (h != pCache->h)))
- XAATileCache(pScrn, pCache, w, h);
-
- return pCache;
-}
-
-
-
-XAACacheInfoPtr
-XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache = pCachePriv->InfoMono;
- int i;
-
- for(i = 0; i < pCachePriv->NumMono; i++, pCache++) {
- if(pCache->serialNumber &&
- (pCache->pat0 == pat0) && (pCache->pat1 == pat1))
- return pCache;
- }
-
- /* OK, let's cache it */
- pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++];
- if(pCachePriv->CurrentMono >= pCachePriv->NumMono)
- pCachePriv->CurrentMono = 0;
-
- pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */
- pCache->pat0 = pat0;
- pCache->pat1 = pat1;
-
- (*infoRec->WriteMono8x8PatternToCache)(pScrn, pCache);
-
- return pCache;
-}
-
-
-
-XAACacheInfoPtr
-XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- XAACacheInfoPtr pCache = pCachePriv->InfoColor;
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- int i;
-
- if(!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) {
- for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
- if(pCache->serialNumber == pPix->drawable.serialNumber) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
- pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
- if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
- pCachePriv->CurrentColor = 0;
-
- pCache->serialNumber = pPix->drawable.serialNumber;
- pCache->trans_color = pCache->fg = pCache->bg = -1;
- } else {
- int pat0 = pixPriv->pattern0;
- int pat1 = pixPriv->pattern1;
-
- if(fg == -1) { /* it's a tile */
- fg = pixPriv->fg; bg = pixPriv->bg;
- }
-
- if(bg == -1) { /* stipple */
- for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
- if(pCache->serialNumber &&
- (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
- (pCache->fg == fg) && (pCache->bg != fg)) {
- pCache->trans_color = pCache->bg;
- return pCache;
- }
- }
- } else { /* opaque stipple */
- for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
- if(pCache->serialNumber &&
- (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
- (pCache->fg == fg) && (pCache->bg == bg)) {
- pCache->trans_color = -1;
- return pCache;
- }
- }
- }
- pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
- if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
- pCachePriv->CurrentColor = 0;
-
- if(bg == -1)
- pCache->trans_color = bg = fg ^ 1;
- else
- pCache->trans_color = -1;
-
- pCache->pat0 = pat0; pCache->pat1 = pat1;
- pCache->fg = fg; pCache->bg = bg;
- pCache->serialNumber = 1;
- }
-
- (*infoRec->WriteColor8x8PatternToCache)(pScrn, pPix, pCache);
-
- return pCache;
-}
-
-
-void
-XAAWriteBitmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->WriteBitmap)(pScrn, x, y, w, h, src, srcwidth,
- 0, fg, bg, GXcopy, ~0);
-}
-
-void
-XAAWriteBitmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-){
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pScreenPix, pDstPix;
- XID gcvals[2];
- GCPtr pGC;
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width,
- y + h, pScreenPix->drawable.depth,
- pScreenPix->drawable.bitsPerPixel,
- pScreenPix->devKind,
- pScreenPix->devPrivate.ptr);
-
- pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
- gcvals[0] = fg;
- gcvals[1] = bg;
- DoChangeGC(pGC, GCForeground | GCBackground, gcvals, 0);
- ValidateGC((DrawablePtr)pDstPix, pGC);
-
- /* We've unwrapped already so these ops miss a sync */
- SYNC_CHECK(pScrn);
-
- (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, 1, x, y, w, h, 0,
- XYBitmap, (pointer)src);
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(pDstPix);
-}
-
-
-void
-XAAWritePixmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-) {
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
-
- (*infoRec->WritePixmap)(pScrn, x, y, w, h, src, srcwidth,
- GXcopy, ~0, -1, bpp, depth);
-}
-
-
-
-void
-XAAWritePixmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-){
- ScreenPtr pScreen = pScrn->pScreen;
- PixmapPtr pScreenPix, pDstPix;
- GCPtr pGC;
-
- pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
-
- pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h,
- depth, bpp, pScreenPix->devKind,
- pScreenPix->devPrivate.ptr);
-
- pGC = GetScratchGC(depth, pScreen);
- ValidateGC((DrawablePtr)pDstPix, pGC);
-
- /* We've unwrapped already so these ops miss a sync */
- SYNC_CHECK(pScrn);
-
- if(bpp == BitsPerPixel(depth))
- (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, depth, x, y, w,
- h, 0, ZPixmap, (pointer)src);
- else {
- PixmapPtr pSrcPix;
-
- pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp,
- srcwidth, (pointer)src);
-
- (*pGC->ops->CopyArea)((DrawablePtr)pSrcPix, (DrawablePtr)pDstPix,
- pGC, 0, 0, w, h, x, y);
-
- FreeScratchPixmapHeader(pSrcPix);
- }
-
- FreeScratchGC(pGC);
- FreeScratchPixmapHeader(pDstPix);
-}
-
-
-void
-XAAWriteMono8x8PatternToCache(
- ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- unsigned char *data;
- int pad, Bpp = (pScrn->bitsPerPixel >> 3);
-
- pCache->offsets = pCachePriv->MonoOffsets;
-
- pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
-
- data = (unsigned char*)xalloc(pad * pCache->h);
- if(!data) return;
-
- if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- CARD32* ptr = (CARD32*)data;
- ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
- } else {
- CARD32 *ptr;
- DDXPointPtr pPoint = pCache->offsets;
- int patx, paty, i;
-
- for(i = 0; i < 64; i++, pPoint++) {
- patx = pCache->pat0; paty = pCache->pat1;
- XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- ptr = (CARD32*)(data + (pad * pPoint->y) + (Bpp * pPoint->x));
- ptr[0] = patx; ptr[1] = paty;
- }
- }
-
- (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
- pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
-
- xfree(data);
-}
-
-void
-XAAWriteColor8x8PatternToCache(
- ScrnInfoPtr pScrn,
- PixmapPtr pPix,
- XAACacheInfoPtr pCache
-){
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- int pad, i, w, h, nw, nh, Bpp;
- unsigned char *data, *srcPtr, *dstPtr;
-
- pCache->offsets = pCachePriv->ColorOffsets;
-
- if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
- CARD32* ptr;
- pad = BitmapBytePad(pCache->w);
- data = (unsigned char*)xalloc(pad * pCache->h);
- if(!data) return;
-
- if(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
- ptr = (CARD32*)data;
- ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
- } else {
- int patx, paty;
-
- ptr = (CARD32*)data;
- ptr[0] = ptr[2] = pCache->pat0; ptr[1] = ptr[3] = pCache->pat1;
- for(i = 1; i < 8; i++) {
- patx = pCache->pat0; paty = pCache->pat1;
- XAARotateMonoPattern(&patx, &paty, i, 0,
- (infoRec->Mono8x8PatternFillFlags &
- BIT_ORDER_IN_BYTE_MSBFIRST));
- ptr = (CARD32*)(data + (pad * i));
- ptr[0] = ptr[2] = patx; ptr[1] = ptr[3] = paty;
- }
- }
-
- (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
- pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg);
-
- xfree(data);
- return;
- }
-
- Bpp = pScrn->bitsPerPixel >> 3;
- h = min(8,pPix->drawable.height);
- w = min(8,pPix->drawable.width);
- pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
-
- data = (unsigned char*)xalloc(pad * pCache->h);
- if(!data) return;
-
- /* Write and expand horizontally. */
- for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--;
- srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) {
- nw = w;
- memcpy(dstPtr, srcPtr, w * Bpp);
- while (nw != 8) {
- memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp);
- nw <<= 1;
- }
- }
- nh = h;
- /* Expand vertically. */
- while (nh != 8) {
- memcpy(data + (nh*pScrn->bitsPerPixel), data, nh*pScrn->bitsPerPixel);
- nh <<= 1;
- }
-
- if(!(infoRec->Color8x8PatternFillFlags &
- HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
- int j;
- unsigned char *ptr = data + (128 * Bpp);
-
- memcpy(data + (64 * Bpp), data, 64 * Bpp);
- for(i = 1; i < 8; i++, ptr += (128 * Bpp)) {
- for(j = 0; j < 8; j++) {
- memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp,
- (8 - i) * Bpp);
- memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp, i*Bpp);
- }
- memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp);
- }
- }
-
- (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
- pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
-
- xfree(data);
-}
-
-
-
-int
-XAAStippledFillChooser(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- PixmapPtr pPixmap = pGC->stipple;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
-
- if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
- (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
- XAACheckStippleReducibility(pPixmap);
- }
-
-
- if(pPriv->flags & REDUCIBLE_TO_8x8) {
- if(infoRec->CanDoMono8x8 &&
- !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_FG(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
-
- return DO_MONO_8x8;
- }
-
- if(infoRec->CanDoColor8x8 &&
- !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
-
- return DO_COLOR_8x8;
- }
- }
-
- if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
- infoRec->CacheColorExpandDensity) &&
- !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_FG(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
-
- return DO_CACHE_EXPAND;
- }
-
-
- if(infoRec->UsingPixmapCache &&
- !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
- infoRec->FillCacheBltSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
- !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_CACHE_BLT;
- }
-
- if(infoRec->FillColorExpandSpans &&
- !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) &&
- ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags &
- TRANSPARENCY_GXCOPY_ONLY)) &&
- CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_FG(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
-
- return DO_COLOR_EXPAND;
- }
-
- return 0;
-}
-
-
-int
-XAAOpaqueStippledFillChooser(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- PixmapPtr pPixmap = pGC->stipple;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
-
- if(XAA_DEPTH_BUG(pGC))
- return 0;
-
- if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
- (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
- XAACheckStippleReducibility(pPixmap);
- }
-
- if(pPriv->flags & REDUCIBLE_TO_8x8) {
- if(infoRec->CanDoMono8x8 &&
- !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_COLORS(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
-
- return DO_MONO_8x8;
- }
-
- if(infoRec->CanDoColor8x8 &&
- CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
-
- return DO_COLOR_8x8;
- }
- }
-
- if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
- infoRec->CacheColorExpandDensity) &&
- !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_COLORS(pGC,infoRec->FillCacheExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
-
- return DO_CACHE_EXPAND;
- }
-
- if(infoRec->UsingPixmapCache &&
- !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
- infoRec->FillCacheBltSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_CACHE_BLT;
- }
-
- if(infoRec->FillColorExpandSpans &&
- !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_COLORS(pGC,infoRec->FillColorExpandSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
-
- return DO_COLOR_EXPAND;
- }
-
- return 0;
-}
-
-
-
-int
-XAATiledFillChooser(GCPtr pGC)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- PixmapPtr pPixmap = pGC->tile.pixmap;
- XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
-
- if(IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_PIXMAP_COPY;
- }
-
- if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
- (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
- XAACheckTileReducibility(pPixmap,infoRec->CanDoMono8x8);
- }
-
- if(pPriv->flags & REDUCIBLE_TO_8x8) {
- if((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 &&
- !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
- CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
- (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) ||
- (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) &&
- CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
-
- return DO_MONO_8x8;
- }
-
- if(infoRec->CanDoColor8x8 &&
- CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
-
- return DO_COLOR_8x8;
- }
- }
-
- if(infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans &&
- (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
- (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
- CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
-
- return DO_CACHE_BLT;
- }
-
- if(infoRec->FillImageWriteRects &&
- CHECK_NO_GXCOPY(pGC,infoRec->FillImageWriteRectsFlags) &&
- CHECK_ROP(pGC,infoRec->FillImageWriteRectsFlags) &&
- CHECK_ROPSRC(pGC,infoRec->FillImageWriteRectsFlags) &&
- CHECK_PLANEMASK(pGC,infoRec->FillImageWriteRectsFlags)) {
-
- return DO_IMAGE_WRITE;
- }
-
- return 0;
-}
-
-
-static int RotateMasksX[8] = {
- 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F,
- 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101
-};
-
-static int RotateMasksY[4] = {
- 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF
-};
-
-void
-XAARotateMonoPattern(
- int *pat0, int *pat1,
- int xorg, int yorg,
- Bool msbfirst
-){
- int tmp, mask;
-
- if(xorg) {
- if(msbfirst) xorg = 8 - xorg;
- mask = RotateMasksX[xorg];
- *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask);
- *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask);
- }
- if(yorg >= 4) {
- tmp = *pat0; *pat0 = *pat1; *pat1 = tmp;
- yorg -= 4;
- }
- if(yorg) {
- mask = RotateMasksY[yorg];
- yorg <<= 3;
- tmp = *pat0;
- *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask);
- *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask);
- }
-}
-
-
-
-void
-XAAInvalidatePixmapCache(ScreenPtr pScreen)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAAPixmapCachePrivatePtr pCachePriv =
- (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
- int i;
-
- if(!pCachePriv) return;
-
- for(i = 0; i < pCachePriv->Num512x512; i++)
- (pCachePriv->Info512)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->Num256x256; i++)
- (pCachePriv->Info256)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->Num128x128; i++)
- (pCachePriv->Info128)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->NumPartial; i++)
- (pCachePriv->InfoPartial)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->NumMono; i++)
- (pCachePriv->InfoMono)[i].serialNumber = 0;
- for(i = 0; i < pCachePriv->NumColor; i++)
- (pCachePriv->InfoColor)[i].serialNumber = 0;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "gc.h"
+#include "mi.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "regionstr.h"
+#include "servermd.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaacexp.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+
+#define MAX_COLOR 32
+#define MAX_MONO 32
+#define MAX_8 32
+#define MAX_128 32
+#define MAX_256 32
+#define MAX_512 16
+
+static int CacheInitIndex = -1;
+#define CACHEINIT(p) ((p)->privates[CacheInitIndex].val)
+
+
+typedef struct _CacheLink {
+ int x;
+ int y;
+ int w;
+ int h;
+ struct _CacheLink *next;
+} CacheLink, *CacheLinkPtr;
+
+
+static void
+TransferList(CacheLinkPtr list, XAACacheInfoPtr array, int num)
+{
+ while(num--) {
+ array->x = list->x;
+ array->y = list->y;
+ array->w = list->w;
+ array->h = list->h;
+ array->serialNumber = 0;
+ array->fg = array->bg = -1;
+ list = list->next;
+ array++;
+ }
+}
+
+
+
+static CacheLinkPtr
+Enlist(CacheLinkPtr link, int x, int y, int w, int h)
+{
+ CacheLinkPtr newLink;
+
+ newLink = malloc(sizeof(CacheLink));
+ newLink->next = link;
+ newLink->x = x; newLink->y = y;
+ newLink->w = w; newLink->h = h;
+ return newLink;
+}
+
+
+
+static CacheLinkPtr
+Delist(CacheLinkPtr link) {
+ CacheLinkPtr ret = NULL;
+
+ if(link) {
+ ret = link->next;
+ free(link);
+ }
+ return ret;
+}
+
+
+
+static void
+FreeList(CacheLinkPtr link) {
+ CacheLinkPtr tmp;
+
+ while(link) {
+ tmp = link;
+ link = link->next;
+ free(tmp);
+ }
+}
+
+
+
+static CacheLinkPtr
+QuadLinks(CacheLinkPtr big, CacheLinkPtr little)
+{
+ /* CAUTION: This doesn't free big */
+ int w1, w2, h1, h2;
+
+ while(big) {
+ w1 = big->w >> 1;
+ w2 = big->w - w1;
+ h1 = big->h >> 1;
+ h2 = big->h - h1;
+
+ little = Enlist(little, big->x, big->y, w1, h1);
+ little = Enlist(little, big->x + w1, big->y, w2, h1);
+ little = Enlist(little, big->x, big->y + h1, w1, h2);
+ little = Enlist(little, big->x + w1, big->y + h1, w2, h2);
+
+ big = big->next;
+ }
+ return little;
+}
+
+
+static void
+SubdivideList(CacheLinkPtr *large, CacheLinkPtr *small)
+{
+ CacheLinkPtr big = *large;
+ CacheLinkPtr little = *small;
+ int size = big->w >> 1;
+
+ little = Enlist(little, big->x, big->y, size, size);
+ little = Enlist(little, big->x + size, big->y, size, size);
+ little = Enlist(little, big->x, big->y + size, size, size);
+ little = Enlist(little, big->x + size, big->y + size, size, size);
+ *small = little;
+ big = Delist(big);
+ *large = big;
+}
+
+static void
+FreePixmapCachePrivate(XAAPixmapCachePrivatePtr pPriv)
+{
+ if(!pPriv) return;
+
+ if(pPriv->Info512)
+ free(pPriv->Info512);
+ if(pPriv->Info256)
+ free(pPriv->Info256);
+ if(pPriv->Info128)
+ free(pPriv->Info128);
+ if(pPriv->InfoColor)
+ free(pPriv->InfoColor);
+ if(pPriv->InfoMono)
+ free(pPriv->InfoMono);
+ if(pPriv->InfoPartial)
+ free(pPriv->InfoPartial);
+
+ free(pPriv);
+}
+
+void
+XAAClosePixmapCache(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if(infoRec->PixmapCachePrivate)
+ FreePixmapCachePrivate(
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
+
+ infoRec->PixmapCachePrivate = NULL;
+}
+
+
+
+static CacheLinkPtr
+ThinOutPartials(
+ CacheLinkPtr ListPartial,
+ int *num, int *maxw, int *maxh
+) {
+/* This guy's job is to get at least 4 big slots out of a list of fragments */
+
+ CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
+ int Num64, Num32, Num16, Num8, NumKeepers;
+ int w, h;
+
+ List64 = List32 = List16 = List8 = ListKeepers = NULL;
+ Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
+ w = h = 0;
+
+ /* We sort partials by how large a square tile they can cache.
+ If a partial can't store a 64x64, 32x32, 16x16 or 8x8 tile,
+ we free it. */
+
+ pCur = ListPartial;
+ while(pCur) {
+ next = pCur->next;
+ if((pCur->w >= 64) && (pCur->h >= 64)) {
+ pCur->next = List64; List64 = pCur;
+ Num64++;
+ } else
+ if((pCur->w >= 32) && (pCur->h >= 32)) {
+ pCur->next = List32; List32 = pCur;
+ Num32++;
+ } else
+ if((pCur->w >= 16) && (pCur->h >= 16)) {
+ pCur->next = List16; List16 = pCur;
+ Num16++;
+ } else
+ if((pCur->w >= 8) && (pCur->h >= 8)) {
+ pCur->next = List8; List8 = pCur;
+ Num8++;
+ } else {
+ free(pCur);
+ }
+
+ pCur = next;
+ }
+
+ /* We save all the tiles from the largest bin that we can get
+ at least 4 of. If there are too few of a bigger slot, we
+ cut it in fourths to make smaller slots. */
+
+ if(Num64 >= 4) {
+ ListKeepers = List64; List64 = NULL;
+ NumKeepers = Num64;
+ goto GOT_EM;
+ } else if(Num64) {
+ List32 = QuadLinks(List64, List32);
+ Num32 += Num64 * 4;
+ Num64 = 0;
+ }
+
+ if(Num32 >= 4) {
+ ListKeepers = List32; List32 = NULL;
+ NumKeepers = Num32;
+ goto GOT_EM;
+ } else if(Num32) {
+ List16 = QuadLinks(List32, List16);
+ Num16 += Num32 * 4;
+ Num32 = 0;
+ }
+
+ if(Num16 >= 4) {
+ ListKeepers = List16; List16 = NULL;
+ NumKeepers = Num16;
+ goto GOT_EM;
+ } else if(Num16) {
+ List8 = QuadLinks(List16, List8);
+ Num8 += Num16 * 4;
+ Num16 = 0;
+ }
+
+ if(Num8 >= 4) {
+ ListKeepers = List8; List8 = NULL;
+ NumKeepers = Num8;
+ goto GOT_EM;
+ }
+
+GOT_EM:
+
+ /* Free the ones we aren't using */
+
+ if(List64) FreeList(List64);
+ if(List32) FreeList(List32);
+ if(List16) FreeList(List16);
+ if(List8) FreeList(List8);
+
+
+ /* Enlarge the slots if we can */
+
+ if(ListKeepers) {
+ CacheLinkPtr pLink = ListKeepers;
+ w = h = 128;
+
+ while(pLink) {
+ if(pLink->w < w) w = pLink->w;
+ if(pLink->h < h) h = pLink->h;
+ pLink = pLink->next;
+ }
+ }
+
+ *maxw = w;
+ *maxh = h;
+ *num = NumKeepers;
+ return ListKeepers;
+}
+
+static void
+ConvertColorToMono(
+ CacheLinkPtr *ColorList,
+ int ColorW, int ColorH,
+ CacheLinkPtr *MonoList,
+ int MonoW, int MonoH
+){
+ int x, y, w;
+
+ x = (*ColorList)->x; y = (*ColorList)->y;
+ *ColorList = Delist(*ColorList);
+
+ while(ColorH) {
+ ColorH -= MonoH;
+ for(w = 0; w <= (ColorW - MonoW); w += MonoW)
+ *MonoList = Enlist(*MonoList, x + w, y + ColorH, MonoW, MonoH);
+ }
+}
+
+static void
+ConvertAllPartialsTo8x8(
+ int *NumMono, int *NumColor,
+ CacheLinkPtr ListPartial,
+ CacheLinkPtr *ListMono,
+ CacheLinkPtr *ListColor,
+ XAAInfoRecPtr infoRec
+){
+/* This guy extracts as many 8x8 slots as it can out of fragments */
+
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ int x, y, w, Height, Width;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+ CacheLinkPtr pLink = ListPartial;
+ CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
+
+ if(DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if(MonoH > ColorH) ColorH = MonoH;
+ if(MonoW > ColorW) ColorW = MonoW;
+ }
+
+ /* Break up the area into as many Color and Mono slots as we can */
+
+ while(pLink) {
+ Height = pLink->h;
+ Width = pLink->w;
+ x = pLink->x;
+ y = pLink->y;
+
+ if(DoColor) {
+ while(Height >= ColorH) {
+ Height -= ColorH;
+ for(w = 0; w <= (Width - ColorW); w += ColorW) {
+ ColorList = Enlist(
+ ColorList, x + w, y + Height, ColorW, ColorH);
+ (*NumColor)++;
+ }
+ }
+ }
+
+ if(DoMono && (Height >= MonoH)) {
+ while(Height >= MonoH) {
+ Height -= MonoH;
+ for(w = 0; w <= (Width - MonoW); w += MonoW) {
+ MonoList = Enlist(
+ MonoList, x + w, y + Height, MonoW, MonoH);
+ (*NumMono)++;
+ }
+ }
+ }
+
+ pLink = pLink->next;
+ }
+
+
+ *ListMono = MonoList;
+ *ListColor = ColorList;
+ FreeList(ListPartial);
+}
+
+
+static CacheLinkPtr
+ExtractOneThatFits(CacheLinkPtr *initList, int w, int h)
+{
+ CacheLinkPtr list = *initList;
+ CacheLinkPtr prev = NULL;
+
+ while(list) {
+ if((list->w >= w) && (list->h >= h))
+ break;
+ prev = list;
+ list = list->next;
+ }
+
+ if(list) {
+ if(prev)
+ prev->next = list->next;
+ else
+ *initList = list->next;
+
+ list->next = NULL;
+ }
+
+ return list;
+}
+
+
+static CacheLinkPtr
+ConvertSomePartialsTo8x8(
+ int *NumMono, int *NumColor, int *NumPartial,
+ CacheLinkPtr ListPartial,
+ CacheLinkPtr *ListMono,
+ CacheLinkPtr *ListColor,
+ int *maxw, int *maxh,
+ XAAInfoRecPtr infoRec
+){
+/* This guy tries to get 4 of each type of 8x8 slot requested out of
+ a list of fragments all while trying to retain some big fragments
+ for the cache blits */
+
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+ CacheLinkPtr List64, List32, List16, List8, pCur, next, ListKeepers;
+ CacheLinkPtr MonoList = *ListMono, ColorList = *ListColor;
+ int Num64, Num32, Num16, Num8, NumKeepers;
+ int w, h, Width, Height;
+ int MonosPerColor = 1;
+
+ if(DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if(MonoH > ColorH) ColorH = MonoH;
+ if(MonoW > ColorW) ColorW = MonoW;
+ MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
+ }
+
+ List64 = List32 = List16 = List8 = ListKeepers = MonoList = ColorList = NULL;
+ Num64 = Num32 = Num16 = Num8 = NumKeepers = 0;
+ Width = Height = 0;
+
+ /* We sort partials by how large a square tile they can cache.
+ We make 8x8 patterns from the leftovers if we can. */
+
+ pCur = ListPartial;
+ while(pCur) {
+ next = pCur->next;
+ if((pCur->w >= 64) && (pCur->h >= 64)) {
+ pCur->next = List64; List64 = pCur;
+ Num64++;
+ } else
+ if((pCur->w >= 32) && (pCur->h >= 32)) {
+ pCur->next = List32; List32 = pCur;
+ Num32++;
+ } else
+ if((pCur->w >= 16) && (pCur->h >= 16)) {
+ pCur->next = List16; List16 = pCur;
+ Num16++;
+ } else
+ if((pCur->w >= 8) && (pCur->h >= 8)) {
+ pCur->next = List8; List8 = pCur;
+ Num8++;
+ } else {
+ h = pCur->h;
+ if(DoColor && (pCur->w >= ColorW) && (h >= ColorH)) {
+ while(h >= ColorH) {
+ h -= ColorH;
+ for(w = 0; w <= (pCur->w - ColorW); w += ColorW) {
+ ColorList = Enlist( ColorList,
+ pCur->x + w, pCur->y + h, ColorW, ColorH);
+ (*NumColor)++;
+ }
+ }
+ }
+ if(DoMono && (pCur->w >= MonoW) && (h >= MonoH)) {
+ while(h >= MonoH) {
+ h -= MonoH;
+ for(w = 0; w <= (pCur->w - MonoW); w += MonoW) {
+ MonoList = Enlist( MonoList,
+ pCur->x + w, pCur->y + h, MonoW, MonoH);
+ (*NumMono)++;
+ }
+ }
+ }
+ free(pCur);
+ }
+
+ pCur = next;
+ }
+
+ /* Try to extract at least 4 of each type of 8x8 slot that we need */
+
+ if(DoColor) {
+ CacheLinkPtr theOne;
+ while(*NumColor < 4) {
+ theOne = NULL;
+ if(Num8) {
+ if((theOne = ExtractOneThatFits(&List8, ColorW, ColorH)))
+ Num8--;
+ }
+ if(Num16 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List16, ColorW, ColorH)))
+ Num16--;
+ }
+ if(Num32 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List32, ColorW, ColorH)))
+ Num32--;
+ }
+ if(Num64 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List64, ColorW, ColorH)))
+ Num64--;
+ }
+
+ if(!theOne) break;
+
+
+ ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
+ &MonoList, &ColorList, infoRec);
+
+ if(DoMono) {
+ while(*NumColor && (*NumMono < 4)) {
+ ConvertColorToMono(&ColorList, ColorW, ColorH,
+ &MonoList, MonoW, MonoH);
+ (*NumColor)--; *NumMono += MonosPerColor;
+ }
+ }
+ }
+ }
+
+ if(DoMono) {
+ CacheLinkPtr theOne;
+ while(*NumMono < 4) {
+ theOne = NULL;
+ if(Num8) {
+ if((theOne = ExtractOneThatFits(&List8, MonoW, MonoH)))
+ Num8--;
+ }
+ if(Num16 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List16, MonoW, MonoH)))
+ Num16--;
+ }
+ if(Num32 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List32, MonoW, MonoH)))
+ Num32--;
+ }
+ if(Num64 && !theOne) {
+ if((theOne = ExtractOneThatFits(&List64, MonoW, MonoH)))
+ Num64--;
+ }
+
+ if(!theOne) break;
+
+ ConvertAllPartialsTo8x8(NumMono, NumColor, theOne,
+ &MonoList, &ColorList, infoRec);
+ }
+ }
+
+ /* We save all the tiles from the largest bin that we can get
+ at least 4 of. If there are too few of a bigger slot, we
+ cut it in fourths to make smaller slots. */
+
+ if(Num64 >= 4) {
+ ListKeepers = List64; List64 = NULL;
+ NumKeepers = Num64;
+ goto GOT_EM;
+ } else if(Num64) {
+ List32 = QuadLinks(List64, List32);
+ Num32 += Num64 * 4;
+ Num64 = 0;
+ }
+
+ if(Num32 >= 4) {
+ ListKeepers = List32; List32 = NULL;
+ NumKeepers = Num32;
+ goto GOT_EM;
+ } else if(Num32) {
+ List16 = QuadLinks(List32, List16);
+ Num16 += Num32 * 4;
+ Num32 = 0;
+ }
+
+ if(Num16 >= 4) {
+ ListKeepers = List16; List16 = NULL;
+ NumKeepers = Num16;
+ goto GOT_EM;
+ } else if(Num16) {
+ List8 = QuadLinks(List16, List8);
+ Num8 += Num16 * 4;
+ Num16 = 0;
+ }
+
+ if(Num8 >= 4) {
+ ListKeepers = List8; List8 = NULL;
+ NumKeepers = Num8;
+ goto GOT_EM;
+ }
+
+GOT_EM:
+
+ /* Free the ones we aren't using */
+
+ if(List64)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List64,
+ &MonoList, &ColorList, infoRec);
+ if(List32)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List32,
+ &MonoList, &ColorList, infoRec);
+ if(List16)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List16,
+ &MonoList, &ColorList, infoRec);
+ if(List8)
+ ConvertAllPartialsTo8x8(NumMono, NumColor, List8,
+ &MonoList, &ColorList, infoRec);
+
+
+ /* Enlarge the slots if we can */
+
+ if(ListKeepers) {
+ CacheLinkPtr pLink = ListKeepers;
+ Width = Height = 128;
+
+ while(pLink) {
+ if(pLink->w < Width) Width = pLink->w;
+ if(pLink->h < Height) Height = pLink->h;
+ pLink = pLink->next;
+ }
+ }
+
+ *ListMono = MonoList;
+ *ListColor = ColorList;
+ *maxw = Width;
+ *maxh = Height;
+ *NumPartial = NumKeepers;
+ return ListKeepers;
+}
+
+
+void
+XAAInitPixmapCache(
+ ScreenPtr pScreen,
+ RegionPtr areas,
+ pointer data
+) {
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAInfoRecPtr infoRec = (XAAInfoRecPtr)data;
+ XAAPixmapCachePrivatePtr pCachePriv;
+ BoxPtr pBox = REGION_RECTS(areas);
+ int nBox = REGION_NUM_RECTS(areas);
+ int Num512, Num256, Num128, NumPartial, NumColor, NumMono;
+ int Target512, Target256;
+ CacheLinkPtr List512, List256, List128, ListPartial, ListColor, ListMono;
+ int x, y, w, h, ntotal, granularity, width, height, i;
+ int MaxPartialWidth, MaxPartialHeight;
+
+ infoRec->MaxCacheableTileWidth = 0;
+ infoRec->MaxCacheableTileHeight = 0;
+ infoRec->MaxCacheableStippleHeight = 0;
+ infoRec->MaxCacheableStippleWidth = 0;
+ infoRec->UsingPixmapCache = FALSE;
+
+
+ if(!nBox || !pBox || !(infoRec->Flags & PIXMAP_CACHE))
+ return;
+
+ /* Allocate a persistent per-screen init flag to control messages */
+ if (CacheInitIndex < 0)
+ CacheInitIndex = xf86AllocateScrnInfoPrivateIndex();
+
+ /* free the old private data if it exists */
+ if(infoRec->PixmapCachePrivate) {
+ FreePixmapCachePrivate(
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate);
+ infoRec->PixmapCachePrivate = NULL;
+ }
+
+ Num512 = Num256 = Num128 = NumPartial = NumMono = NumColor = 0;
+ List512 = List256 = List128 = ListPartial = ListMono = ListColor = NULL;
+ granularity = infoRec->CachePixelGranularity;
+ if(granularity <= 1) granularity = 0;
+
+ /* go through the boxes and break it into as many pieces as we can fit */
+
+ while(nBox--) {
+ x = pBox->x1;
+ if(granularity) {
+ int tmp = x % granularity;
+ if(tmp) x += (granularity - tmp);
+ }
+ width = pBox->x2 - x;
+ if(width <= 0) {pBox++; continue;}
+
+ y = pBox->y1;
+ height = pBox->y2 - y;
+
+ for(h = 0; h <= (height - 512); h += 512) {
+ for(w = 0; w <= (width - 512); w += 512) {
+ List512 = Enlist(List512, x + w, y + h, 512, 512);
+ Num512++;
+ }
+ for(; w <= (width - 256); w += 256) {
+ List256 = Enlist(List256, x + w, y + h, 256, 256);
+ List256 = Enlist(List256, x + w, y + h + 256, 256, 256);
+ Num256 += 2;
+ }
+ for(; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 256, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 384, 128, 128);
+ Num128 += 4;
+ }
+ if(w < width) {
+ int d = width - w;
+ ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 256, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 384, d, 128);
+ NumPartial += 4;
+ }
+ }
+ for(; h <= (height - 256); h += 256) {
+ for(w = 0; w <= (width - 256); w += 256) {
+ List256 = Enlist(List256, x + w, y + h, 256, 256);
+ Num256++;
+ }
+ for(; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ List128 = Enlist(List128, x + w, y + h + 128, 128, 128);
+ Num128 += 2;
+ }
+ if(w < width) {
+ int d = width - w;
+ ListPartial = Enlist(ListPartial, x + w, y + h, d, 128);
+ ListPartial = Enlist(ListPartial, x + w, y + h + 128, d, 128);
+ NumPartial += 2;
+ }
+ }
+ for(; h <= (height - 128); h += 128) {
+ for(w = 0; w <= (width - 128); w += 128) {
+ List128 = Enlist(List128, x + w, y + h, 128, 128);
+ Num128++;
+ }
+ if(w < width) {
+ ListPartial = Enlist(
+ ListPartial, x + w, y + h, width - w, 128);
+ NumPartial++;
+ }
+ }
+ if(h < height) {
+ int d = height - h;
+ for(w = 0; w <= (width - 128); w += 128) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, 128, d);
+ NumPartial++;
+ }
+ if(w < width) {
+ ListPartial = Enlist(ListPartial, x + w, y + h, width - w, d);
+ NumPartial++;
+ }
+ }
+ pBox++;
+ }
+
+
+/*
+ by this point we've carved the space into as many 512x512, 256x256
+ and 128x128 blocks as we could fit. We will then break larger
+ blocks into smaller ones if we need to. The rules are as follows:
+
+ 512x512 -
+ 1) Don't take up more than half the memory.
+ 2) Don't bother if you can't get at least four.
+ 3) Don't make more than MAX_512.
+ 4) Don't have any of there are no 256x256s.
+
+ 256x256 -
+ 1) Don't take up more than a quarter of the memory enless there
+ aren't any 512x512s. Then we can take up to half.
+ 2) Don't bother if you can't get at least four.
+ 3) Don't make more than MAX_256.
+
+ 128x128 -
+ 1) Don't make more than MAX_128.
+
+ We don't bother with the partial blocks unless we can use them
+ for 8x8 pattern fills or we are short on larger blocks.
+
+*/
+
+ ntotal = Num128 + (Num256<<2) + (Num512<<4);
+
+ Target512 = ntotal >> 5;
+ if(Target512 < 4) Target512 = 0;
+ if(!Target512) Target256 = ntotal >> 3;
+ else Target256 = ntotal >> 4;
+ if(Target256 < 4) Target256 = 0;
+
+ if(Num512 && Num256 < 4) {
+ while(Num512 && Num256 < Target256) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ }
+ }
+
+ if(!Num512) { /* no room */
+ } else if((Num512 < 4) || (!Target512)) {
+ while(Num512) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ }
+ } else if((Num512 > MAX_512) || (Num512 > Target512)){
+ while(Num512 > MAX_512) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ }
+ while(Num512 > Target512) {
+ if(Num256 < MAX_256) {
+ SubdivideList(&List512, &List256);
+ Num256 += 4; Num512--;
+ } else break;
+ }
+ }
+
+ if(!Num256) { /* no room */
+ } else if((Num256 < 4) || (!Target256)) {
+ while(Num256) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4; Num256--;
+ }
+ } else if((Num256 > MAX_256) || (Num256 > Target256)) {
+ while(Num256 > MAX_256) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4; Num256--;
+ }
+ while(Num256 > Target256) {
+ if(Num128 < MAX_128) {
+ SubdivideList(&List256, &List128);
+ Num128 += 4; Num256--;
+ } else break;
+ }
+ }
+
+ if(Num128 && ((Num128 < 4) || (Num128 > MAX_128))) {
+ CacheLinkPtr next;
+ int max = (Num128 > MAX_128) ? MAX_128 : 0;
+
+ /*
+ * Note: next is set in this way to work around a code generation
+ * bug in gcc 2.7.2.3.
+ */
+ next = List128->next;
+ while(Num128 > max) {
+ List128->next = ListPartial;
+ ListPartial = List128;
+ if((List128 = next))
+ next = List128->next;
+ NumPartial++; Num128--;
+ }
+ }
+
+ MaxPartialHeight = MaxPartialWidth = 0;
+
+ /* at this point we have as many 512x512 and 256x256 slots as we
+ want but may have an excess of 128x128 slots. We still need
+ to find out if we need 8x8 slots. We take these from the
+ partials if we have them. Otherwise, we break some 128x128's */
+
+ if(!(infoRec->PixmapCacheFlags & (CACHE_MONO_8x8 | CACHE_COLOR_8x8))) {
+ if(NumPartial) {
+ if(Num128) { /* don't bother with partials */
+ FreeList(ListPartial);
+ NumPartial = 0; ListPartial = NULL;
+ } else {
+ /* We have no big slots. Weed out the unusable partials */
+ ListPartial = ThinOutPartials(ListPartial, &NumPartial,
+ &MaxPartialWidth, &MaxPartialHeight);
+ }
+ }
+ } else {
+ int MonosPerColor = 1;
+ int ColorH = infoRec->CacheHeightColor8x8Pattern;
+ int ColorW = infoRec->CacheWidthColor8x8Pattern;
+ int MonoH = infoRec->CacheHeightMono8x8Pattern;
+ int MonoW = infoRec->CacheWidthMono8x8Pattern;
+ Bool DoColor = (infoRec->PixmapCacheFlags & CACHE_COLOR_8x8);
+ Bool DoMono = (infoRec->PixmapCacheFlags & CACHE_MONO_8x8);
+
+ if(DoColor) infoRec->CanDoColor8x8 = FALSE;
+ if(DoMono) infoRec->CanDoMono8x8 = FALSE;
+
+ if(DoColor && DoMono) {
+ /* we assume color patterns take more space than color ones */
+ if(MonoH > ColorH) ColorH = MonoH;
+ if(MonoW > ColorW) ColorW = MonoW;
+ MonosPerColor = (ColorH/MonoH) * (ColorW/MonoW);
+ }
+
+ if(Num128) {
+ if(NumPartial) { /* use all for 8x8 slots */
+ ConvertAllPartialsTo8x8(&NumMono, &NumColor,
+ ListPartial, &ListMono, &ListColor, infoRec);
+ NumPartial = 0; ListPartial = NULL;
+ }
+
+ /* Get some 8x8 slots from the 128 slots */
+ while((Num128 > 4) &&
+ ((NumMono < MAX_MONO) && (NumColor < MAX_COLOR))) {
+ CacheLinkPtr tmp = NULL;
+
+ tmp = Enlist(tmp, List128->x, List128->y,
+ List128->w, List128->h);
+ List128 = Delist(List128);
+ Num128--;
+
+ ConvertAllPartialsTo8x8(&NumMono, &NumColor,
+ tmp, &ListMono, &ListColor, infoRec);
+ }
+ } else if(NumPartial) {
+ /* We have share partials between 8x8 slots and tiles. */
+ ListPartial = ConvertSomePartialsTo8x8(&NumMono, &NumColor,
+ &NumPartial, ListPartial, &ListMono, &ListColor,
+ &MaxPartialWidth, &MaxPartialHeight, infoRec);
+ }
+
+
+ if(DoMono && DoColor) {
+ if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
+ int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
+
+ while(NumColor > max) {
+ ConvertColorToMono(&ListColor, ColorW, ColorH,
+ &ListMono, MonoW, MonoH);
+ NumColor--; NumMono += MonosPerColor;
+ }
+ }
+
+ /* favor Mono slots over Color ones */
+ while((NumColor > 4) && (NumMono < MAX_MONO)) {
+ ConvertColorToMono(&ListColor, ColorW, ColorH,
+ &ListMono, MonoW, MonoH);
+ NumColor--; NumMono += MonosPerColor;
+ }
+ }
+
+ if(NumMono && ((NumMono > MAX_MONO) || (NumMono < 4))) {
+ int max = (NumMono > MAX_MONO) ? MAX_MONO : 0;
+
+ while(NumMono > max) {
+ ListMono = Delist(ListMono);
+ NumMono--;
+ }
+ }
+ if(NumColor && ((NumColor > MAX_COLOR) || (NumColor < 4))) {
+ int max = (NumColor > MAX_COLOR) ? MAX_COLOR : 0;
+
+ while(NumColor > max) {
+ ListColor = Delist(ListColor);
+ NumColor--;
+ }
+ }
+ }
+
+
+ pCachePriv = calloc(1,sizeof(XAAPixmapCachePrivate));
+ if(!pCachePriv) {
+ if(Num512) FreeList(List512);
+ if(Num256) FreeList(List256);
+ if(Num128) FreeList(List128);
+ if(NumPartial) FreeList(ListPartial);
+ if(NumColor) FreeList(ListColor);
+ if(NumMono) FreeList(ListMono);
+ return;
+ }
+
+ infoRec->PixmapCachePrivate = (char*)pCachePriv;
+
+ if(Num512) {
+ pCachePriv->Info512 = calloc(Num512,sizeof(XAACacheInfoRec));
+ if(!pCachePriv->Info512) Num512 = 0;
+ if(Num512) TransferList(List512, pCachePriv->Info512, Num512);
+ FreeList(List512);
+ pCachePriv->Num512x512 = Num512;
+ }
+ if(Num256) {
+ pCachePriv->Info256 = calloc(Num256, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->Info256) Num256 = 0;
+ if(Num256) TransferList(List256, pCachePriv->Info256, Num256);
+ FreeList(List256);
+ pCachePriv->Num256x256 = Num256;
+ }
+ if(Num128) {
+ pCachePriv->Info128 = calloc(Num128, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->Info128) Num128 = 0;
+ if(Num128) TransferList(List128, pCachePriv->Info128, Num128);
+ FreeList(List128);
+ pCachePriv->Num128x128 = Num128;
+ }
+
+ if(NumPartial) {
+ pCachePriv->InfoPartial = calloc(NumPartial, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->InfoPartial) NumPartial = 0;
+ if(NumPartial)
+ TransferList(ListPartial, pCachePriv->InfoPartial, NumPartial);
+ FreeList(ListPartial);
+ pCachePriv->NumPartial = NumPartial;
+ }
+
+ if(NumColor) {
+ pCachePriv->InfoColor = calloc(NumColor, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->InfoColor) NumColor = 0;
+ if(NumColor) TransferList(ListColor, pCachePriv->InfoColor, NumColor);
+ FreeList(ListColor);
+ pCachePriv->NumColor = NumColor;
+ }
+
+ if(NumMono) {
+ pCachePriv->InfoMono = calloc(NumMono, sizeof(XAACacheInfoRec));
+ if(!pCachePriv->InfoMono) NumMono = 0;
+ if(NumMono) TransferList(ListMono, pCachePriv->InfoMono, NumMono);
+ FreeList(ListMono);
+ pCachePriv->NumMono = NumMono;
+ }
+
+
+ if(NumPartial) {
+ infoRec->MaxCacheableTileWidth = MaxPartialWidth;
+ infoRec->MaxCacheableTileHeight = MaxPartialHeight;
+ }
+ if(Num128)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 128;
+ if(Num256)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 256;
+ if(Num512)
+ infoRec->MaxCacheableTileWidth = infoRec->MaxCacheableTileHeight = 512;
+
+
+ infoRec->MaxCacheableStippleHeight = infoRec->MaxCacheableTileHeight;
+ infoRec->MaxCacheableStippleWidth =
+ infoRec->MaxCacheableTileWidth * pScrn->bitsPerPixel;
+ if(infoRec->ScreenToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP)
+ infoRec->MaxCacheableStippleWidth /= 3;
+
+ if(NumMono) {
+ if(!(infoRec->Mono8x8PatternFillFlags &
+ (HARDWARE_PATTERN_PROGRAMMED_ORIGIN |
+ HARDWARE_PATTERN_PROGRAMMED_BITS))) {
+ int numPerLine =
+ infoRec->CacheWidthMono8x8Pattern/infoRec->MonoPatternPitch;
+
+ for(i = 0; i < 64; i++) {
+ pCachePriv->MonoOffsets[i].y = i/numPerLine;
+ pCachePriv->MonoOffsets[i].x = (i % numPerLine) *
+ infoRec->MonoPatternPitch;
+ }
+ }
+ infoRec->CanDoMono8x8 = TRUE;
+ }
+ if(NumColor) {
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)) {
+
+ for(i = 0; i < 64; i++) {
+ pCachePriv->ColorOffsets[i].y = i & 0x07;
+ pCachePriv->ColorOffsets[i].x = i & ~0x07;
+ }
+ }
+ infoRec->CanDoColor8x8 = TRUE;
+ }
+
+ if(!CACHEINIT(pScrn)) {
+ xf86ErrorF("\tSetting up tile and stipple cache:\n");
+ if(NumPartial)
+ xf86ErrorF("\t\t%i %ix%i slots\n",
+ NumPartial, MaxPartialWidth, MaxPartialHeight);
+ if(Num128) xf86ErrorF("\t\t%i 128x128 slots\n", Num128);
+ if(Num256) xf86ErrorF("\t\t%i 256x256 slots\n", Num256);
+ if(Num512) xf86ErrorF("\t\t%i 512x512 slots\n", Num512);
+ if(NumColor) xf86ErrorF("\t\t%i 8x8 color pattern slots\n", NumColor);
+ if(NumMono) xf86ErrorF("\t\t%i 8x8 color expansion slots\n", NumMono);
+ }
+
+ if(!(NumPartial | Num128 | Num256 | Num512 | NumColor | NumMono)) {
+ if(!CACHEINIT(pScrn))
+ xf86ErrorF("\t\tNot enough video memory for pixmap cache\n");
+ } else infoRec->UsingPixmapCache = TRUE;
+
+ CACHEINIT(pScrn) = 1;
+}
+
+#if X_BYTE_ORDER == X_BIG_ENDIAN
+static CARD32 StippleMasks[4] = {
+ 0x80808080,
+ 0xC0C0C0C0,
+ 0x00000000,
+ 0xF0F0F0F0
+};
+#else
+static CARD32 StippleMasks[4] = {
+ 0x01010101,
+ 0x03030303,
+ 0x00000000,
+ 0x0F0F0F0F
+};
+#endif
+
+Bool
+XAACheckStippleReducibility(PixmapPtr pPixmap)
+{
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
+ CARD32 *IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ int w = pPixmap->drawable.width;
+ int h = pPixmap->drawable.height;
+ int i;
+ CARD32 bits[8];
+ CARD32 mask = SHIFT_R(0xFFFFFFFF,24);
+
+ pPriv->flags |= REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR;
+ pPriv->flags &= ~REDUCIBLE_TO_8x8;
+
+ if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
+ return FALSE;
+
+ i = (h > 8) ? 8 : h;
+
+ switch(w) {
+ case 32:
+ while(i--) {
+ bits[i] = IntPtr[i] & mask;
+ if( (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask, 8)), 8)) ||
+ (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,16)),16)) ||
+ (bits[i] != SHIFT_R((IntPtr[i] & SHIFT_L(mask,24)),24)))
+ return FALSE;
+ }
+ break;
+ case 16:
+ while(i--) {
+ bits[i] = IntPtr[i] & mask;
+ if(bits[i] != ((IntPtr[i] & SHIFT_R(SHIFT_L(mask,8),8))))
+ return FALSE;
+ }
+ break;
+ default:
+ while(i--)
+ bits[i] = IntPtr[i] & mask;
+ break;
+ }
+
+ switch(h) {
+ case 32:
+ if( (IntPtr[8] != IntPtr[16]) || (IntPtr[9] != IntPtr[17]) ||
+ (IntPtr[10] != IntPtr[18]) || (IntPtr[11] != IntPtr[19]) ||
+ (IntPtr[12] != IntPtr[20]) || (IntPtr[13] != IntPtr[21]) ||
+ (IntPtr[14] != IntPtr[22]) || (IntPtr[15] != IntPtr[23]) ||
+ (IntPtr[16] != IntPtr[24]) || (IntPtr[17] != IntPtr[25]) ||
+ (IntPtr[18] != IntPtr[26]) || (IntPtr[19] != IntPtr[27]) ||
+ (IntPtr[20] != IntPtr[28]) || (IntPtr[21] != IntPtr[29]) ||
+ (IntPtr[22] != IntPtr[30]) || (IntPtr[23] != IntPtr[31]))
+ return FALSE;
+ /* fall through */
+ case 16:
+ if( (IntPtr[0] != IntPtr[8]) || (IntPtr[1] != IntPtr[9]) ||
+ (IntPtr[2] != IntPtr[10]) || (IntPtr[3] != IntPtr[11]) ||
+ (IntPtr[4] != IntPtr[12]) || (IntPtr[5] != IntPtr[13]) ||
+ (IntPtr[6] != IntPtr[14]) || (IntPtr[7] != IntPtr[15]))
+ return FALSE;
+ case 8: break;
+ case 1: bits[1] = bits[0];
+ case 2: bits[2] = bits[0]; bits[3] = bits[1];
+ case 4: bits[4] = bits[0]; bits[5] = bits[1];
+ bits[6] = bits[2]; bits[7] = bits[3];
+ break;
+ }
+
+ pPriv->flags |= REDUCIBLE_TO_8x8;
+
+ pPriv->pattern0 = bits[0] | SHIFT_L(bits[1],8) | SHIFT_L(bits[2],16) | SHIFT_L(bits[3],24);
+ pPriv->pattern1 = bits[4] | SHIFT_L(bits[5],8) | SHIFT_L(bits[6],16) | SHIFT_L(bits[7],24);
+
+ if(w < 8) {
+ pPriv->pattern0 &= StippleMasks[w - 1];
+ pPriv->pattern1 &= StippleMasks[w - 1];
+
+ switch(w) {
+ case 1: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,1);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,1);
+ case 2: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,2);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,2);
+ case 4: pPriv->pattern0 |= SHIFT_L(pPriv->pattern0,4);
+ pPriv->pattern1 |= SHIFT_L(pPriv->pattern1,4);
+ }
+ }
+
+ if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
+ pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
+ }
+
+
+ return TRUE;
+}
+
+
+Bool
+XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono)
+{
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+ CARD32 *IntPtr;
+ int w = pPixmap->drawable.width;
+ int h = pPixmap->drawable.height;
+ int pitch = pPixmap->devKind >> 2;
+ int dwords, i, j;
+
+ pPriv->flags |= REDUCIBILITY_CHECKED;
+ pPriv->flags &= ~(REDUCIBILITY_CHECKED | REDUCIBLE_TO_2_COLOR);
+
+ if((w > 32) || (h > 32) || (w & (w - 1)) || (h & (h - 1)))
+ return FALSE;
+
+ dwords = ((w * pPixmap->drawable.bitsPerPixel) + 31) >> 5;
+ i = (h > 8) ? 8 : h;
+
+
+ if(w > 8) {
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ switch(pPixmap->drawable.bitsPerPixel) {
+ case 8:
+ while(i--) {
+ for(j = 2; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j & 0x01])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 16:
+ while(i--) {
+ for(j = 4; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j & 0x03])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 24:
+ while(i--) {
+ for(j = 6; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j % 6])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ case 32:
+ while(i--) {
+ for(j = 8; j < dwords; j++)
+ if(IntPtr[j] != IntPtr[j & 0x07])
+ return FALSE;
+ IntPtr += pitch;
+ }
+ break;
+ default: return FALSE;
+ }
+
+ }
+
+
+ if(h == 32) {
+ CARD32 *IntPtr2, *IntPtr3, *IntPtr4;
+ i = 8;
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ IntPtr2 = IntPtr + (pitch << 3);
+ IntPtr3 = IntPtr2 + (pitch << 3);
+ IntPtr4 = IntPtr3 + (pitch << 3);
+ while(i--) {
+ for(j = 0; j < dwords; j++)
+ if((IntPtr[j] != IntPtr2[j]) || (IntPtr[j] != IntPtr3[j]) ||
+ (IntPtr[j] != IntPtr4[j]))
+ return FALSE;
+ IntPtr += pitch;
+ IntPtr2 += pitch;
+ IntPtr3 += pitch;
+ IntPtr4 += pitch;
+ }
+ } else if (h == 16) {
+ CARD32 *IntPtr2;
+ i = 8;
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ IntPtr2 = IntPtr + (pitch << 3);
+ while(i--) {
+ for(j = 0; j < dwords; j++)
+ if(IntPtr[j] != IntPtr2[j])
+ return FALSE;
+ IntPtr += pitch;
+ IntPtr2 += pitch;
+ }
+ }
+
+ pPriv->flags |= REDUCIBLE_TO_8x8;
+
+ if(checkMono) {
+ XAAInfoRecPtr infoRec =
+ GET_XAAINFORECPTR_FROM_DRAWABLE(&pPixmap->drawable);
+ unsigned char bits[8];
+ int fg, bg = -1, x, y;
+
+ i = (h > 8) ? 8 : h;
+ j = (w > 8) ? 8 : w;
+
+ if(pPixmap->drawable.bitsPerPixel == 8) {
+ unsigned char *srcp = pPixmap->devPrivate.ptr;
+ fg = srcp[0];
+ pitch = pPixmap->devKind;
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x++) {
+ if(srcp[x] != fg) {
+ if(bg == -1) bg = srcp[x];
+ else if(bg != srcp[x]) return TRUE;
+ } else bits[y] |= 1 << x;
+ }
+ srcp += pitch;
+ }
+ } else if(pPixmap->drawable.bitsPerPixel == 16) {
+ unsigned short *srcp = (unsigned short*)pPixmap->devPrivate.ptr;
+ fg = srcp[0];
+ pitch = pPixmap->devKind >> 1;
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x++) {
+ if(srcp[x] != fg) {
+ if(bg == -1) bg = srcp[x];
+ else if(bg != srcp[x]) return TRUE;
+ } else bits[y] |= 1 << x;
+ }
+ srcp += pitch;
+ }
+ } else if(pPixmap->drawable.bitsPerPixel == 24) {
+ CARD32 val;
+ unsigned char *srcp = pPixmap->devPrivate.ptr;
+ fg = *((CARD32*)srcp) & 0x00FFFFFF;
+ pitch = pPixmap->devKind;
+ j *= 3;
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x+=3) {
+ val = *((CARD32*)(srcp+x)) & 0x00FFFFFF;
+ if(val != fg) {
+ if(bg == -1) bg = val;
+ else if(bg != val)
+ return TRUE;
+ } else bits[y] |= 1 << (x/3);
+ }
+ srcp += pitch;
+ }
+ } else if(pPixmap->drawable.bitsPerPixel == 32) {
+ IntPtr = (CARD32*)pPixmap->devPrivate.ptr;
+ fg = IntPtr[0];
+ for(y = 0; y < i; y++) {
+ bits[y] = 0;
+ for(x = 0; x < j; x++) {
+ if(IntPtr[x] != fg) {
+ if(bg == -1) bg = IntPtr[x];
+ else if(bg != IntPtr[x]) return TRUE;
+ } else bits[y] |= 1 << x;
+ }
+ IntPtr += pitch;
+ }
+ } else return TRUE;
+
+ pPriv->fg = fg;
+ if(bg == -1) pPriv->bg = fg;
+ else pPriv->bg = bg;
+
+ if(h < 8) {
+ switch(h) {
+ case 1: bits[1] = bits[0];
+ case 2: bits[2] = bits[0]; bits[3] = bits[1];
+ case 4: bits[4] = bits[0]; bits[5] = bits[1];
+ bits[6] = bits[2]; bits[7] = bits[3];
+ break;
+ }
+ }
+
+ pPriv->pattern0 =
+ bits[0] | (bits[1]<<8) | (bits[2]<<16) | (bits[3]<<24);
+ pPriv->pattern1 =
+ bits[4] | (bits[5]<<8) | (bits[6]<<16) | (bits[7]<<24);
+
+ if(w < 8) {
+ switch(w) {
+ case 1: pPriv->pattern0 |= (pPriv->pattern0 << 1);
+ pPriv->pattern1 |= (pPriv->pattern1 << 1);
+ case 2: pPriv->pattern0 |= (pPriv->pattern0 << 2);
+ pPriv->pattern1 |= (pPriv->pattern1 << 2);
+ case 4: pPriv->pattern0 |= (pPriv->pattern0 << 4);
+ pPriv->pattern1 |= (pPriv->pattern1 << 4);
+ }
+ }
+ pPriv->flags |= REDUCIBLE_TO_2_COLOR;
+
+ if(infoRec->Mono8x8PatternFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST) {
+ pPriv->pattern0 = SWAP_BITS_IN_BYTES(pPriv->pattern0);
+ pPriv->pattern1 = SWAP_BITS_IN_BYTES(pPriv->pattern1);
+ }
+
+ }
+
+ return TRUE;
+}
+
+
+void XAATileCache(
+ ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache,
+ int w, int h
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->SetupForScreenToScreenCopy)(pScrn, 1, 1, GXcopy, ~0, -1);
+
+ while((w << 1) <= pCache->w) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x + w, pCache->y, w, h);
+ w <<= 1;
+ }
+ if(w != pCache->w) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x + w, pCache->y, pCache->w - w, h);
+ w = pCache->w;
+ }
+
+ while((h << 1) <= pCache->h) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x, pCache->y + h, w, h);
+ h <<= 1;
+ }
+ if(h != pCache->h) {
+ (*infoRec->SubsequentScreenToScreenCopy)(pScrn, pCache->x, pCache->y,
+ pCache->x, pCache->y + h, w, pCache->h - h);
+ }
+ SET_SYNC_FLAG(infoRec);
+}
+
+XAACacheInfoPtr
+XAACacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ int size = max(w, h);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if(size <= 128) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if(size <= 256) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if(size <= 512) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheTile()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for(i = 0; i < max; i++, pCache++) {
+ if(pCache->serialNumber == pPix->drawable.serialNumber) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w; pCache->orig_h = h;
+ (*infoRec->WritePixmapToCache)(
+ pScrn, pCache->x, pCache->y, w, h, pPix->devPrivate.ptr,
+ pPix->devKind, pPix->drawable.bitsPerPixel, pPix->drawable.depth);
+ if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0, funcNo, pad, dwords, bpp = pScrn->bitsPerPixel;
+ int *current;
+ StippleScanlineProcPtr StippleFunc;
+ unsigned char *data, *srcPtr, *dstPtr;
+
+ if((h <= 128) && (w <= 128 * bpp)) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if((h <= 256) && (w <= 256 * bpp)){
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if((h <= 512) && (w <= 526 * bpp)){
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheMonoStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (pCache->fg == -1) && (pCache->bg == -1)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w; pCache->orig_h = h;
+
+ if(w <= 32) {
+ if(w & (w - 1)) funcNo = 1;
+ else funcNo = 0;
+ } else funcNo = 2;
+
+ pad = BitmapBytePad(pCache->w * bpp);
+ dwords = bytes_to_int32(pad);
+ dstPtr = data = (unsigned char*)malloc(pad * pCache->h);
+ srcPtr = (unsigned char*)pPix->devPrivate.ptr;
+
+ if(infoRec->ScreenToScreenColorExpandFillFlags & BIT_ORDER_IN_BYTE_MSBFIRST)
+ StippleFunc = XAAStippleScanlineFuncMSBFirst[funcNo];
+ else
+ StippleFunc = XAAStippleScanlineFuncLSBFirst[funcNo];
+
+ /* don't bother generating more than we'll ever use */
+ max = ((pScrn->displayWidth + w - 1) + 31) >> 5;
+ if(dwords > max)
+ dwords = max;
+
+ for(i = 0; i < h; i++) {
+ (*StippleFunc)((CARD32*)dstPtr, (CARD32*)srcPtr, 0, w, dwords);
+ srcPtr += pPix->devKind;
+ dstPtr += pad;
+ }
+
+ while((h<<1) <= pCache->h) {
+ memcpy(data + (pad * h), data, pad * h);
+ h <<= 1;
+ }
+
+ if(h < pCache->h)
+ memcpy(data + (pad * h), data, pad * (pCache->h - h));
+
+ (*infoRec->WritePixmapToCache)(
+ pScrn, pCache->x, pCache->y, pCache->w, pCache->h, data,
+ pad, bpp, pScrn->depth);
+
+ free(data);
+
+ return pCache;
+}
+
+XAACacheInfoPtr
+XAACachePlanarMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if((h <= 128) && (w <= 128)) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if((h <= 256) && (w <= 256)){
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if((h <= 512) && (w <= 526)){
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACachePlanarMonoStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+
+ /* lets look for it */
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (pCache->fg == -1) && (pCache->bg == -1)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->bg = pCache->fg = -1;
+ pCache->orig_w = w; pCache->orig_h = h;
+
+ /* Plane 0 holds the stipple. Plane 1 holds the inverted stipple */
+ (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
+ pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
+ pPix->devKind, 1, 2);
+ if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_MONO_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+XAACachePlanarMonoStippleProc
+XAAGetCachePlanarMonoStipple(void)
+{
+ return XAACachePlanarMonoStipple;
+}
+
+XAACacheInfoPtr
+XAACacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ int w = pPix->drawable.width;
+ int h = pPix->drawable.height;
+ int size = max(w, h);
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache, cacheRoot = NULL;
+ int i, max = 0;
+ int *current;
+
+ if(size <= 128) {
+ if(pCachePriv->Info128) {
+ cacheRoot = pCachePriv->Info128;
+ max = pCachePriv->Num128x128;
+ current = &pCachePriv->Current128;
+ } else {
+ cacheRoot = pCachePriv->InfoPartial;
+ max = pCachePriv->NumPartial;
+ current = &pCachePriv->CurrentPartial;
+ }
+ } else if(size <= 256) {
+ cacheRoot = pCachePriv->Info256;
+ max = pCachePriv->Num256x256;
+ current = &pCachePriv->Current256;
+ } else if(size <= 512) {
+ cacheRoot = pCachePriv->Info512;
+ max = pCachePriv->Num512x512;
+ current = &pCachePriv->Current512;
+ } else { /* something's wrong */
+ ErrorF("Something's wrong in XAACacheStipple()\n");
+ return pCachePriv->Info128;
+ }
+
+ pCache = cacheRoot;
+ /* lets look for it */
+ if(bg == -1)
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (fg == pCache->fg) && (pCache->fg != pCache->bg)) {
+ pCache->trans_color = pCache->bg;
+ return pCache;
+ }
+ }
+ else
+ for(i = 0; i < max; i++, pCache++) {
+ if((pCache->serialNumber == pPix->drawable.serialNumber) &&
+ (fg == pCache->fg) && (bg == pCache->bg)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+
+ pCache = &cacheRoot[(*current)++];
+ if(*current >= max) *current = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->fg = fg;
+ if(bg == -1)
+ pCache->trans_color = bg = fg ^ 1;
+ else
+ pCache->trans_color = -1;
+ pCache->bg = bg;
+
+ pCache->orig_w = w; pCache->orig_h = h;
+ (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
+ pPix->drawable.width, pPix->drawable.height, pPix->devPrivate.ptr,
+ pPix->devKind, fg, bg);
+ if(!(infoRec->PixmapCacheFlags & DO_NOT_TILE_COLOR_DATA) &&
+ ((w != pCache->w) || (h != pCache->h)))
+ XAATileCache(pScrn, pCache, w, h);
+
+ return pCache;
+}
+
+
+
+XAACacheInfoPtr
+XAACacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0, int pat1)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache = pCachePriv->InfoMono;
+ int i;
+
+ for(i = 0; i < pCachePriv->NumMono; i++, pCache++) {
+ if(pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1))
+ return pCache;
+ }
+
+ /* OK, let's cache it */
+ pCache = &pCachePriv->InfoMono[pCachePriv->CurrentMono++];
+ if(pCachePriv->CurrentMono >= pCachePriv->NumMono)
+ pCachePriv->CurrentMono = 0;
+
+ pCache->serialNumber = 1; /* we don't care since we do lookups by pattern */
+ pCache->pat0 = pat0;
+ pCache->pat1 = pat1;
+
+ (*infoRec->WriteMono8x8PatternToCache)(pScrn, pCache);
+
+ return pCache;
+}
+
+
+
+XAACacheInfoPtr
+XAACacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg, int bg)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ XAACacheInfoPtr pCache = pCachePriv->InfoColor;
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ int i;
+
+ if(!(pixPriv->flags & REDUCIBLE_TO_2_COLOR)) {
+ for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if(pCache->serialNumber == pPix->drawable.serialNumber) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+ pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
+ if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
+ pCachePriv->CurrentColor = 0;
+
+ pCache->serialNumber = pPix->drawable.serialNumber;
+ pCache->trans_color = pCache->fg = pCache->bg = -1;
+ } else {
+ int pat0 = pixPriv->pattern0;
+ int pat1 = pixPriv->pattern1;
+
+ if(fg == -1) { /* it's a tile */
+ fg = pixPriv->fg; bg = pixPriv->bg;
+ }
+
+ if(bg == -1) { /* stipple */
+ for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if(pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
+ (pCache->fg == fg) && (pCache->bg != fg)) {
+ pCache->trans_color = pCache->bg;
+ return pCache;
+ }
+ }
+ } else { /* opaque stipple */
+ for(i = 0; i < pCachePriv->NumColor; i++, pCache++) {
+ if(pCache->serialNumber &&
+ (pCache->pat0 == pat0) && (pCache->pat1 == pat1) &&
+ (pCache->fg == fg) && (pCache->bg == bg)) {
+ pCache->trans_color = -1;
+ return pCache;
+ }
+ }
+ }
+ pCache = &pCachePriv->InfoColor[pCachePriv->CurrentColor++];
+ if(pCachePriv->CurrentColor >= pCachePriv->NumColor)
+ pCachePriv->CurrentColor = 0;
+
+ if(bg == -1)
+ pCache->trans_color = bg = fg ^ 1;
+ else
+ pCache->trans_color = -1;
+
+ pCache->pat0 = pat0; pCache->pat1 = pat1;
+ pCache->fg = fg; pCache->bg = bg;
+ pCache->serialNumber = 1;
+ }
+
+ (*infoRec->WriteColor8x8PatternToCache)(pScrn, pPix, pCache);
+
+ return pCache;
+}
+
+
+void
+XAAWriteBitmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->WriteBitmap)(pScrn, x, y, w, h, src, srcwidth,
+ 0, fg, bg, GXcopy, ~0);
+}
+
+void
+XAAWriteBitmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+){
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pScreenPix, pDstPix;
+ ChangeGCVal gcvals[2];
+ GCPtr pGC;
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ pDstPix = GetScratchPixmapHeader(pScreen, pScreenPix->drawable.width,
+ y + h, pScreenPix->drawable.depth,
+ pScreenPix->drawable.bitsPerPixel,
+ pScreenPix->devKind,
+ pScreenPix->devPrivate.ptr);
+
+ pGC = GetScratchGC(pScreenPix->drawable.depth, pScreen);
+ gcvals[0].val = fg;
+ gcvals[1].val = bg;
+ ChangeGC(NullClient, pGC, GCForeground | GCBackground, gcvals);
+ ValidateGC((DrawablePtr)pDstPix, pGC);
+
+ /* We've unwrapped already so these ops miss a sync */
+ SYNC_CHECK(pScrn);
+
+ (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, 1, x, y, w, h, 0,
+ XYBitmap, (pointer)src);
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(pDstPix);
+}
+
+
+void
+XAAWritePixmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+) {
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+
+ (*infoRec->WritePixmap)(pScrn, x, y, w, h, src, srcwidth,
+ GXcopy, ~0, -1, bpp, depth);
+}
+
+
+
+void
+XAAWritePixmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+){
+ ScreenPtr pScreen = pScrn->pScreen;
+ PixmapPtr pScreenPix, pDstPix;
+ GCPtr pGC;
+
+ pScreenPix = (*pScreen->GetScreenPixmap)(pScreen);
+
+ pDstPix = GetScratchPixmapHeader(pScreen, x + w, y + h,
+ depth, bpp, pScreenPix->devKind,
+ pScreenPix->devPrivate.ptr);
+
+ pGC = GetScratchGC(depth, pScreen);
+ ValidateGC((DrawablePtr)pDstPix, pGC);
+
+ /* We've unwrapped already so these ops miss a sync */
+ SYNC_CHECK(pScrn);
+
+ if(bpp == BitsPerPixel(depth))
+ (*pGC->ops->PutImage)((DrawablePtr)pDstPix, pGC, depth, x, y, w,
+ h, 0, ZPixmap, (pointer)src);
+ else {
+ PixmapPtr pSrcPix;
+
+ pSrcPix = GetScratchPixmapHeader(pScreen, w, h, depth, bpp,
+ srcwidth, (pointer)src);
+
+ (*pGC->ops->CopyArea)((DrawablePtr)pSrcPix, (DrawablePtr)pDstPix,
+ pGC, 0, 0, w, h, x, y);
+
+ FreeScratchPixmapHeader(pSrcPix);
+ }
+
+ FreeScratchGC(pGC);
+ FreeScratchPixmapHeader(pDstPix);
+}
+
+
+void
+XAAWriteMono8x8PatternToCache(
+ ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ unsigned char *data;
+ int pad, Bpp = (pScrn->bitsPerPixel >> 3);
+
+ pCache->offsets = pCachePriv->MonoOffsets;
+
+ pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
+
+ data = (unsigned char*)malloc(pad * pCache->h);
+ if(!data) return;
+
+ if(infoRec->Mono8x8PatternFillFlags & HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ CARD32* ptr = (CARD32*)data;
+ ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
+ } else {
+ CARD32 *ptr;
+ DDXPointPtr pPoint = pCache->offsets;
+ int patx, paty, i;
+
+ for(i = 0; i < 64; i++, pPoint++) {
+ patx = pCache->pat0; paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, i & 0x07, i >> 3,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ ptr = (CARD32*)(data + (pad * pPoint->y) + (Bpp * pPoint->x));
+ ptr[0] = patx; ptr[1] = paty;
+ }
+ }
+
+ (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
+
+ free(data);
+}
+
+void
+XAAWriteColor8x8PatternToCache(
+ ScrnInfoPtr pScrn,
+ PixmapPtr pPix,
+ XAACacheInfoPtr pCache
+){
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE(pPix);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ int pad, i, w, h, nw, nh, Bpp;
+ unsigned char *data, *srcPtr, *dstPtr;
+
+ pCache->offsets = pCachePriv->ColorOffsets;
+
+ if(pixPriv->flags & REDUCIBLE_TO_2_COLOR) {
+ CARD32* ptr;
+ pad = BitmapBytePad(pCache->w);
+ data = (unsigned char*)malloc(pad * pCache->h);
+ if(!data) return;
+
+ if(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN) {
+ ptr = (CARD32*)data;
+ ptr[0] = pCache->pat0; ptr[1] = pCache->pat1;
+ } else {
+ int patx, paty;
+
+ ptr = (CARD32*)data;
+ ptr[0] = ptr[2] = pCache->pat0; ptr[1] = ptr[3] = pCache->pat1;
+ for(i = 1; i < 8; i++) {
+ patx = pCache->pat0; paty = pCache->pat1;
+ XAARotateMonoPattern(&patx, &paty, i, 0,
+ (infoRec->Mono8x8PatternFillFlags &
+ BIT_ORDER_IN_BYTE_MSBFIRST));
+ ptr = (CARD32*)(data + (pad * i));
+ ptr[0] = ptr[2] = patx; ptr[1] = ptr[3] = paty;
+ }
+ }
+
+ (*infoRec->WriteBitmapToCache)(pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad, pCache->fg, pCache->bg);
+
+ free(data);
+ return;
+ }
+
+ Bpp = pScrn->bitsPerPixel >> 3;
+ h = min(8,pPix->drawable.height);
+ w = min(8,pPix->drawable.width);
+ pad = BitmapBytePad(pCache->w * pScrn->bitsPerPixel);
+
+ data = (unsigned char*)malloc(pad * pCache->h);
+ if(!data) return;
+
+ /* Write and expand horizontally. */
+ for (i = h, dstPtr = data, srcPtr = pPix->devPrivate.ptr; i--;
+ srcPtr += pPix->devKind, dstPtr += pScrn->bitsPerPixel) {
+ nw = w;
+ memcpy(dstPtr, srcPtr, w * Bpp);
+ while (nw != 8) {
+ memcpy(dstPtr + (nw * Bpp), dstPtr, nw * Bpp);
+ nw <<= 1;
+ }
+ }
+ nh = h;
+ /* Expand vertically. */
+ while (nh != 8) {
+ memcpy(data + (nh*pScrn->bitsPerPixel), data, nh*pScrn->bitsPerPixel);
+ nh <<= 1;
+ }
+
+ if(!(infoRec->Color8x8PatternFillFlags &
+ HARDWARE_PATTERN_PROGRAMMED_ORIGIN)){
+ int j;
+ unsigned char *ptr = data + (128 * Bpp);
+
+ memcpy(data + (64 * Bpp), data, 64 * Bpp);
+ for(i = 1; i < 8; i++, ptr += (128 * Bpp)) {
+ for(j = 0; j < 8; j++) {
+ memcpy(ptr + (j * 8) * Bpp, data + (j * 8 + i) * Bpp,
+ (8 - i) * Bpp);
+ memcpy(ptr + (j * 8 + 8 - i) * Bpp, data + j * 8 * Bpp, i*Bpp);
+ }
+ memcpy(ptr + (64 * Bpp), ptr, 64 * Bpp);
+ }
+ }
+
+ (*infoRec->WritePixmapToCache)(pScrn, pCache->x, pCache->y,
+ pCache->w, pCache->h, data, pad, pScrn->bitsPerPixel, pScrn->depth);
+
+ free(data);
+}
+
+
+
+int
+XAAStippledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->stipple;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckStippleReducibility(pPixmap);
+ }
+
+
+ if(pPriv->flags & REDUCIBLE_TO_8x8) {
+ if(infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillMono8x8PatternSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_FG(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if(infoRec->CanDoColor8x8 &&
+ !(infoRec->FillColor8x8PatternSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillColor8x8PatternSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
+ infoRec->CacheColorExpandDensity) &&
+ !(infoRec->FillCacheExpandSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillCacheExpandSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_FG(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
+
+ return DO_CACHE_EXPAND;
+ }
+
+
+ if(infoRec->UsingPixmapCache &&
+ !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
+ infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ !(infoRec->FillCacheBltSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillCacheBltSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if(infoRec->FillColorExpandSpans &&
+ !(infoRec->FillColorExpandSpansFlags & NO_TRANSPARENCY) &&
+ ((pGC->alu == GXcopy) || !(infoRec->FillColorExpandSpansFlags &
+ TRANSPARENCY_GXCOPY_ONLY)) &&
+ CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_FG(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
+
+ return DO_COLOR_EXPAND;
+ }
+
+ return 0;
+}
+
+
+int
+XAAOpaqueStippledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->stipple;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if(XAA_DEPTH_BUG(pGC))
+ return 0;
+
+ if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckStippleReducibility(pPixmap);
+ }
+
+ if(pPriv->flags & REDUCIBLE_TO_8x8) {
+ if(infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_COLORS(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if(infoRec->CanDoColor8x8 &&
+ CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if(infoRec->UsingPixmapCache && infoRec->FillCacheExpandSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableStippleHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableStippleWidth /
+ infoRec->CacheColorExpandDensity) &&
+ !(infoRec->FillCacheExpandSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_COLORS(pGC,infoRec->FillCacheExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheExpandSpansFlags)) {
+
+ return DO_CACHE_EXPAND;
+ }
+
+ if(infoRec->UsingPixmapCache &&
+ !(infoRec->PixmapCacheFlags & DO_NOT_BLIT_STIPPLES) &&
+ infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if(infoRec->FillColorExpandSpans &&
+ !(infoRec->FillColorExpandSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_COLORS(pGC,infoRec->FillColorExpandSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColorExpandSpansFlags)) {
+
+ return DO_COLOR_EXPAND;
+ }
+
+ return 0;
+}
+
+
+
+int
+XAATiledFillChooser(GCPtr pGC)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ PixmapPtr pPixmap = pGC->tile.pixmap;
+ XAAPixmapPtr pPriv = XAA_GET_PIXMAP_PRIVATE(pPixmap);
+
+ if(IS_OFFSCREEN_PIXMAP(pPixmap) && infoRec->FillCacheBltSpans &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_PIXMAP_COPY;
+ }
+
+ if(!(pPriv->flags & REDUCIBILITY_CHECKED) &&
+ (infoRec->CanDoMono8x8 || infoRec->CanDoColor8x8)) {
+ XAACheckTileReducibility(pPixmap,infoRec->CanDoMono8x8);
+ }
+
+ if(pPriv->flags & REDUCIBLE_TO_8x8) {
+ if((pPriv->flags & REDUCIBLE_TO_2_COLOR) && infoRec->CanDoMono8x8 &&
+ !(infoRec->FillMono8x8PatternSpansFlags & TRANSPARENCY_ONLY) &&
+ CHECK_ROP(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillMono8x8PatternSpansFlags) &&
+ (!(infoRec->FillMono8x8PatternSpansFlags & RGB_EQUAL) ||
+ (CHECK_RGB_EQUAL(pPriv->fg) && CHECK_RGB_EQUAL(pPriv->bg))) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillMono8x8PatternSpansFlags)) {
+
+ return DO_MONO_8x8;
+ }
+
+ if(infoRec->CanDoColor8x8 &&
+ CHECK_ROP(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillColor8x8PatternSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillColor8x8PatternSpansFlags)) {
+
+ return DO_COLOR_8x8;
+ }
+ }
+
+ if(infoRec->UsingPixmapCache && infoRec->FillCacheBltSpans &&
+ (pPixmap->drawable.height <= infoRec->MaxCacheableTileHeight) &&
+ (pPixmap->drawable.width <= infoRec->MaxCacheableTileWidth) &&
+ CHECK_ROP(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillCacheBltSpansFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillCacheBltSpansFlags)) {
+
+ return DO_CACHE_BLT;
+ }
+
+ if(infoRec->FillImageWriteRects &&
+ CHECK_NO_GXCOPY(pGC,infoRec->FillImageWriteRectsFlags) &&
+ CHECK_ROP(pGC,infoRec->FillImageWriteRectsFlags) &&
+ CHECK_ROPSRC(pGC,infoRec->FillImageWriteRectsFlags) &&
+ CHECK_PLANEMASK(pGC,infoRec->FillImageWriteRectsFlags)) {
+
+ return DO_IMAGE_WRITE;
+ }
+
+ return 0;
+}
+
+
+static int RotateMasksX[8] = {
+ 0xFFFFFFFF, 0x7F7F7F7F, 0x3F3F3F3F, 0x1F1F1F1F,
+ 0x0F0F0F0F, 0x07070707, 0x03030303, 0x01010101
+};
+
+static int RotateMasksY[4] = {
+ 0xFFFFFFFF, 0x00FFFFFF, 0x0000FFFF, 0x000000FF
+};
+
+void
+XAARotateMonoPattern(
+ int *pat0, int *pat1,
+ int xorg, int yorg,
+ Bool msbfirst
+){
+ int tmp, mask;
+
+ if(xorg) {
+ if(msbfirst) xorg = 8 - xorg;
+ mask = RotateMasksX[xorg];
+ *pat0 = ((*pat0 >> xorg) & mask) | ((*pat0 << (8 - xorg)) & ~mask);
+ *pat1 = ((*pat1 >> xorg) & mask) | ((*pat1 << (8 - xorg)) & ~mask);
+ }
+ if(yorg >= 4) {
+ tmp = *pat0; *pat0 = *pat1; *pat1 = tmp;
+ yorg -= 4;
+ }
+ if(yorg) {
+ mask = RotateMasksY[yorg];
+ yorg <<= 3;
+ tmp = *pat0;
+ *pat0 = ((*pat0 >> yorg) & mask) | ((*pat1 << (32 - yorg)) & ~mask);
+ *pat1 = ((*pat1 >> yorg) & mask) | ((tmp << (32 - yorg)) & ~mask);
+ }
+}
+
+
+
+void
+XAAInvalidatePixmapCache(ScreenPtr pScreen)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAAPixmapCachePrivatePtr pCachePriv =
+ (XAAPixmapCachePrivatePtr)infoRec->PixmapCachePrivate;
+ int i;
+
+ if(!pCachePriv) return;
+
+ for(i = 0; i < pCachePriv->Num512x512; i++)
+ (pCachePriv->Info512)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->Num256x256; i++)
+ (pCachePriv->Info256)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->Num128x128; i++)
+ (pCachePriv->Info128)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->NumPartial; i++)
+ (pCachePriv->InfoPartial)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->NumMono; i++)
+ (pCachePriv->InfoMono)[i].serialNumber = 0;
+ for(i = 0; i < pCachePriv->NumColor; i++)
+ (pCachePriv->InfoColor)[i].serialNumber = 0;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaPict.c b/xorg-server/hw/xfree86/xaa/xaaPict.c
index e059d3d65..b66291458 100644
--- a/xorg-server/hw/xfree86/xaa/xaaPict.c
+++ b/xorg-server/hw/xfree86/xaa/xaaPict.c
@@ -1,655 +1,655 @@
-/*
- *
- * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
- *
- * Permission to use, copy, modify, distribute, and sell this software and its
- * documentation for any purpose is hereby granted without fee, provided that
- * the above copyright notice appear in all copies and that both that
- * copyright notice and this permission notice appear in supporting
- * documentation, and that the name of Keith Packard not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Keith Packard makes no
- * representations about the suitability of this software for any purpose. It
- * is provided "as is" without express or implied warranty.
- *
- * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- * PERFORMANCE OF THIS SOFTWARE.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <string.h>
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "picturestr.h"
-#include "glyphstr.h"
-#include "picture.h"
-#include "mipict.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "xaacexp.h"
-#include "xf86fbman.h"
-#include "servermd.h"
-
-Bool
-XAAGetPixelFromRGBA (
- CARD32 *pixel,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 format
-){
- int rbits, bbits, gbits, abits;
- int rshift, bshift, gshift, ashift;
-
- *pixel = 0;
-
- if(!PICT_FORMAT_COLOR(format))
- return FALSE;
-
- rbits = PICT_FORMAT_R(format);
- gbits = PICT_FORMAT_G(format);
- bbits = PICT_FORMAT_B(format);
- abits = PICT_FORMAT_A(format);
-
- if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
- bshift = 0;
- gshift = bbits;
- rshift = gshift + gbits;
- ashift = rshift + rbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
- rshift = 0;
- gshift = rbits;
- bshift = gshift + gbits;
- ashift = bshift + bbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
- bshift = PICT_FORMAT_BPP(format) - bbits;
- gshift = bshift - gbits;
- rshift = gshift - rbits;
- ashift = 0;
- } else
- return FALSE;
-
- *pixel |= ( blue >> (16 - bbits)) << bshift;
- *pixel |= ( red >> (16 - rbits)) << rshift;
- *pixel |= (green >> (16 - gbits)) << gshift;
- *pixel |= (alpha >> (16 - abits)) << ashift;
-
- return TRUE;
-}
-
-
-Bool
-XAAGetRGBAFromPixel(
- CARD32 pixel,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue,
- CARD16 *alpha,
- CARD32 format
-){
- int rbits, bbits, gbits, abits;
- int rshift, bshift, gshift, ashift;
-
- if(!PICT_FORMAT_COLOR(format))
- return FALSE;
-
- rbits = PICT_FORMAT_R(format);
- gbits = PICT_FORMAT_G(format);
- bbits = PICT_FORMAT_B(format);
- abits = PICT_FORMAT_A(format);
-
- if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
- bshift = 0;
- gshift = bbits;
- rshift = gshift + gbits;
- ashift = rshift + rbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
- rshift = 0;
- gshift = rbits;
- bshift = gshift + gbits;
- ashift = bshift + bbits;
- } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
- bshift = PICT_FORMAT_BPP(format) - bbits;
- gshift = bshift - gbits;
- rshift = gshift - rbits;
- ashift = 0;
- } else
- return FALSE;
-
- *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
- while(rbits < 16) {
- *red |= *red >> rbits;
- rbits <<= 1;
- }
-
- *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
- while(gbits < 16) {
- *green |= *green >> gbits;
- gbits <<= 1;
- }
-
- *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
- while(bbits < 16) {
- *blue |= *blue >> bbits;
- bbits <<= 1;
- }
-
- if(abits) {
- *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
- while(abits < 16) {
- *alpha |= *alpha >> abits;
- abits <<= 1;
- }
- } else *alpha = 0xffff;
-
- return TRUE;
-}
-
-/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
-
-void
-XAA_888_plus_PICT_a8_to_8888 (
- CARD32 color,
- CARD8 *alphaPtr, /* in bytes */
- int alphaPitch,
- CARD32 *dstPtr,
- int dstPitch, /* in dwords */
- int width,
- int height
-){
- int x;
-
- color &= 0x00ffffff;
-
- while(height--) {
- for(x = 0; x < width; x++)
- dstPtr[x] = color | (alphaPtr[x] << 24);
- dstPtr += dstPitch;
- alphaPtr += alphaPitch;
- }
-}
-
-#define DRAWABLE_IS_ON_CARD(pDraw) \
- (pDraw->type == DRAWABLE_WINDOW || \
- (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw)))
-
-Bool
-XAADoComposite (
- CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height
-){
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- RegionRec region;
- CARD32 *formats, *dstformats;
- int flags = 0;
- BoxPtr pbox;
- int nbox, w, h;
-
- if(!REGION_NUM_RECTS(pDst->pCompositeClip))
- return TRUE;
-
- if(!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable))
- return FALSE;
-
- if(DRAWABLE_IS_ON_CARD(pSrc->pDrawable))
- return FALSE;
-
- if (pSrc->transform || (pMask && pMask->transform))
- return FALSE;
-
- if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
- return FALSE;
-
- if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
- (pMask && pMask->repeat && pMask->repeatType != RepeatNormal))
- {
- return FALSE;
- }
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if(pMask) {
- if(pMask->componentAlpha)
- return FALSE;
-
- /* for now we only do it if there is a 1x1 (solid) source */
-
- if((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
- CARD16 red, green, blue, alpha;
- CARD32 pixel =
- *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
-
- if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format))
- return FALSE;
-
- xMask += pMask->pDrawable->x;
- yMask += pMask->pDrawable->y;
-
- /* pull out color expandable operations here */
- if((pMask->format == PICT_a1) && (alpha == 0xffff) &&
- (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat &&
- !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) &&
- (!(infoRec->WriteBitmapFlags & RGB_EQUAL) ||
- ((red == green) && (green == blue))))
- {
- PixmapPtr pPix = (PixmapPtr)(pMask->pDrawable);
- int skipleft;
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return TRUE;
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- if(!nbox)
- return TRUE;
-
- XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format);
-
- xMask -= xDst;
- yMask -= yDst;
-
- while(nbox--) {
- skipleft = pbox->x1 + xMask;
-
- (*infoRec->WriteBitmap)(infoRec->pScrn,
- pbox->x1, pbox->y1,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
- (unsigned char*)(pPix->devPrivate.ptr) +
- (pPix->devKind * (pbox->y1 + yMask)) +
- ((skipleft >> 3) & ~3), pPix->devKind,
- skipleft & 31, pixel, -1, GXcopy, ~0);
- pbox++;
- }
-
- /* WriteBitmap sets the Sync flag */
- REGION_UNINIT(pScreen, &region);
- return TRUE;
- }
-
- formats = infoRec->CPUToScreenAlphaTextureFormats;
- dstformats = infoRec->CPUToScreenAlphaTextureDstFormats;
- if(!formats || !dstformats)
- return FALSE;
-
- w = pMask->pDrawable->width;
- h = pMask->pDrawable->height;
-
- if(pMask->repeat) {
- if((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) ||
- ((infoRec->CPUToScreenAlphaTextureFlags &
- XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
- ((h & (h - 1)) || (w & (w - 1)))))
- {
- return FALSE;
- }
- flags |= XAA_RENDER_REPEAT;
- }
-
- if((alpha != 0xffff) &&
- (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
- return FALSE;
-
- while(*formats != pMask->format) {
- if(!(*formats)) return FALSE;
- formats++;
- }
- while(*dstformats != pDst->format) {
- if(!(*dstformats))
- return FALSE;
- dstformats++;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return TRUE;
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- if(!nbox) {
- REGION_UNINIT(pScreen, &region);
- return TRUE;
- }
-
- if(!(infoRec->SetupForCPUToScreenAlphaTexture2)(infoRec->pScrn,
- op, red, green, blue, alpha, pMask->format,
- pDst->format,
- ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr,
- ((PixmapPtr)(pMask->pDrawable))->devKind,
- w, h, flags))
- {
- REGION_UNINIT(pScreen, &region);
- return FALSE;
- }
-
- xMask -= xDst;
- yMask -= yDst;
-
- while(nbox--) {
- (*infoRec->SubsequentCPUToScreenAlphaTexture)(infoRec->pScrn,
- pbox->x1, pbox->y1,
- pbox->x1 + xMask, pbox->y1 + yMask,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
-
- SET_SYNC_FLAG(infoRec);
- REGION_UNINIT(pScreen, &region);
- return TRUE;
- }
- } else {
- formats = infoRec->CPUToScreenTextureFormats;
- dstformats = infoRec->CPUToScreenTextureDstFormats;
- if(!formats || !dstformats)
- return FALSE;
-
- w = pSrc->pDrawable->width;
- h = pSrc->pDrawable->height;
-
- if(pSrc->repeat) {
- if((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) ||
- ((infoRec->CPUToScreenTextureFlags &
- XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
- ((h & (h - 1)) || (w & (w - 1)))))
- {
- return FALSE;
- }
- flags |= XAA_RENDER_REPEAT;
- }
-
- while(*formats != pSrc->format) {
- if(!(*formats)) return FALSE;
- formats++;
- }
- while(*dstformats != pDst->format) {
- if(!(*dstformats))
- return FALSE;
- dstformats++;
- }
-
- if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- return TRUE;
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- if(!nbox) {
- REGION_UNINIT(pScreen, &region);
- return TRUE;
- }
-
- if(!(infoRec->SetupForCPUToScreenTexture2)(infoRec->pScrn,
- op, pSrc->format, pDst->format,
- ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr,
- ((PixmapPtr)(pSrc->pDrawable))->devKind,
- w, h, flags))
- {
- REGION_UNINIT(pScreen, &region);
- return FALSE;
- }
-
-
- xSrc -= xDst;
- ySrc -= yDst;
-
- while(nbox--) {
- (*infoRec->SubsequentCPUToScreenTexture)(infoRec->pScrn,
- pbox->x1, pbox->y1,
- pbox->x1 + xSrc, pbox->y1 + ySrc,
- pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
- pbox++;
- }
-
- SET_SYNC_FLAG(infoRec);
- REGION_UNINIT(pScreen, &region);
- return TRUE;
- }
-
-
- return FALSE;
-}
-
-static void
-XAACompositeSrcCopy (PicturePtr pSrc,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- int i, nbox;
- int xoff, yoff;
- BoxPtr pbox;
- DDXPointPtr pptSrc;
- RegionRec region;
-
- xDst += pDst->pDrawable->x;
- yDst += pDst->pDrawable->y;
- xSrc += pSrc->pDrawable->x;
- ySrc += pSrc->pDrawable->y;
-
- if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
- xSrc, ySrc, 0, 0, xDst, yDst,
- width, height))
- return;
-
- nbox = REGION_NUM_RECTS(&region);
- pbox = REGION_RECTS(&region);
-
- if(!nbox) {
- REGION_UNINIT(pScreen, &region);
- return;
- }
- pptSrc = xalloc(sizeof(DDXPointRec) * nbox);
- if (!pptSrc) {
- REGION_UNINIT(pScreen, &region);
- return;
- }
- xoff = xSrc - xDst;
- yoff = ySrc - yDst;
- for (i = 0; i < nbox; i++) {
- pptSrc[i].x = pbox[i].x1 + xoff;
- pptSrc[i].y = pbox[i].y1 + yoff;
- }
-
- infoRec->ScratchGC.planemask = ~0L;
- infoRec->ScratchGC.alu = GXcopy;
-
- XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
- pptSrc);
-
- xfree(pptSrc);
- REGION_UNINIT(pScreen, &region);
- return;
-}
-
-void
-XAAComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAA_RENDER_PROLOGUE(pScreen, Composite);
-
- if(!pMask && infoRec->pScrn->vtSema &&
- infoRec->ScreenToScreenBitBlt &&
- pSrc->pDrawable &&
- DRAWABLE_IS_ON_CARD(pSrc->pDrawable) &&
- DRAWABLE_IS_ON_CARD(pDst->pDrawable) &&
- !pSrc->transform &&
- (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 &&
- xSrc+width<=pSrc->pDrawable->width &&
- ySrc+height<=pSrc->pDrawable->height)) &&
- ((op == PictOpSrc &&
- ((pSrc->format==pDst->format) ||
- (pSrc->format==PICT_a8r8g8b8 && pDst->format==PICT_x8r8g8b8) ||
- (pSrc->format==PICT_a8b8g8r8 && pDst->format==PICT_x8b8g8r8))) ||
- (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
- pSrc->format==pDst->format &&
- (pSrc->format==PICT_x8r8g8b8 || pSrc->format==PICT_x8b8g8r8))))
- {
- XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height);
- } else if(!pSrc->pDrawable || (pMask && !pMask->pDrawable) ||
- !infoRec->Composite ||
- !(*infoRec->Composite)(op, pSrc, pMask, pDst,
- xSrc, ySrc, xMask, yMask, xDst, yDst,
- width, height))
- {
- if(infoRec->pScrn->vtSema &&
- ((pSrc->pDrawable &&
- (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
- pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
- SYNC_CHECK(pDst->pDrawable);
- }
- (*GetPictureScreen(pScreen)->Composite) (op,
- pSrc,
- pMask,
- pDst,
- xSrc,
- ySrc,
- xMask,
- yMask,
- xDst,
- yDst,
- width,
- height);
- }
-
- if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
- (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
-
- XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
-}
-
-Bool
-XAADoGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
-
- if(!REGION_NUM_RECTS(pDst->pCompositeClip))
- return TRUE;
-
- if(!infoRec->pScrn->vtSema ||
- ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
- !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
- return FALSE;
-
- if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) ||
- IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))
- return FALSE;
-
- /*
- * If it looks like we have a chance of being able to draw these
- * glyphs with an accelerated Composite, do that now to avoid
- * unneeded and costly syncs.
- */
- if(maskFormat) {
- if(!infoRec->CPUToScreenAlphaTextureFormats)
- return FALSE;
- } else {
- if(!infoRec->CPUToScreenTextureFormats)
- return FALSE;
- }
-
- miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
-
- return TRUE;
-}
-
-
-void
-XAAGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
- XAA_RENDER_PROLOGUE(pScreen, Glyphs);
-
- if(!pSrc->pDrawable || !infoRec->Glyphs ||
- !(*infoRec->Glyphs)(op, pSrc, pDst, maskFormat,
- xSrc, ySrc, nlist, list, glyphs))
- {
- if(infoRec->pScrn->vtSema &&
- ((pSrc->pDrawable &&
- (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
- pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
- SYNC_CHECK(pDst->pDrawable);
- }
- (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
- xSrc, ySrc, nlist, list, glyphs);
- }
-
- if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
- (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
-
- XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
-}
+/*
+ *
+ * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Keith Packard not be used in
+ * advertising or publicity pertaining to distribution of the software without
+ * specific, written prior permission. Keith Packard makes no
+ * representations about the suitability of this software for any purpose. It
+ * is provided "as is" without express or implied warranty.
+ *
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <string.h>
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "picturestr.h"
+#include "glyphstr.h"
+#include "picture.h"
+#include "mipict.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "xaacexp.h"
+#include "xf86fbman.h"
+#include "servermd.h"
+
+Bool
+XAAGetPixelFromRGBA (
+ CARD32 *pixel,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 format
+){
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ *pixel = 0;
+
+ if(!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+ bshift = PICT_FORMAT_BPP(format) - bbits;
+ gshift = bshift - gbits;
+ rshift = gshift - rbits;
+ ashift = 0;
+ } else
+ return FALSE;
+
+ *pixel |= ( blue >> (16 - bbits)) << bshift;
+ *pixel |= ( red >> (16 - rbits)) << rshift;
+ *pixel |= (green >> (16 - gbits)) << gshift;
+ *pixel |= (alpha >> (16 - abits)) << ashift;
+
+ return TRUE;
+}
+
+
+Bool
+XAAGetRGBAFromPixel(
+ CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ CARD32 format
+){
+ int rbits, bbits, gbits, abits;
+ int rshift, bshift, gshift, ashift;
+
+ if(!PICT_FORMAT_COLOR(format))
+ return FALSE;
+
+ rbits = PICT_FORMAT_R(format);
+ gbits = PICT_FORMAT_G(format);
+ bbits = PICT_FORMAT_B(format);
+ abits = PICT_FORMAT_A(format);
+
+ if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) {
+ bshift = 0;
+ gshift = bbits;
+ rshift = gshift + gbits;
+ ashift = rshift + rbits;
+ } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ABGR) {
+ rshift = 0;
+ gshift = rbits;
+ bshift = gshift + gbits;
+ ashift = bshift + bbits;
+ } else if(PICT_FORMAT_TYPE(format) == PICT_TYPE_BGRA) {
+ bshift = PICT_FORMAT_BPP(format) - bbits;
+ gshift = bshift - gbits;
+ rshift = gshift - rbits;
+ ashift = 0;
+ } else
+ return FALSE;
+
+ *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits);
+ while(rbits < 16) {
+ *red |= *red >> rbits;
+ rbits <<= 1;
+ }
+
+ *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits);
+ while(gbits < 16) {
+ *green |= *green >> gbits;
+ gbits <<= 1;
+ }
+
+ *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits);
+ while(bbits < 16) {
+ *blue |= *blue >> bbits;
+ bbits <<= 1;
+ }
+
+ if(abits) {
+ *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits);
+ while(abits < 16) {
+ *alpha |= *alpha >> abits;
+ abits <<= 1;
+ }
+ } else *alpha = 0xffff;
+
+ return TRUE;
+}
+
+/* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */
+
+void
+XAA_888_plus_PICT_a8_to_8888 (
+ CARD32 color,
+ CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch,
+ CARD32 *dstPtr,
+ int dstPitch, /* in dwords */
+ int width,
+ int height
+){
+ int x;
+
+ color &= 0x00ffffff;
+
+ while(height--) {
+ for(x = 0; x < width; x++)
+ dstPtr[x] = color | (alphaPtr[x] << 24);
+ dstPtr += dstPitch;
+ alphaPtr += alphaPitch;
+ }
+}
+
+#define DRAWABLE_IS_ON_CARD(pDraw) \
+ (pDraw->type == DRAWABLE_WINDOW || \
+ (pDraw->type == DRAWABLE_PIXMAP && IS_OFFSCREEN_PIXMAP(pDraw)))
+
+Bool
+XAADoComposite (
+ CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height
+){
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ RegionRec region;
+ CARD32 *formats, *dstformats;
+ int flags = 0;
+ BoxPtr pbox;
+ int nbox, w, h;
+
+ if(!REGION_NUM_RECTS(pDst->pCompositeClip))
+ return TRUE;
+
+ if(!infoRec->pScrn->vtSema || !DRAWABLE_IS_ON_CARD(pDst->pDrawable))
+ return FALSE;
+
+ if(DRAWABLE_IS_ON_CARD(pSrc->pDrawable))
+ return FALSE;
+
+ if (pSrc->transform || (pMask && pMask->transform))
+ return FALSE;
+
+ if (pDst->alphaMap || pSrc->alphaMap || (pMask && pMask->alphaMap))
+ return FALSE;
+
+ if ((pSrc->repeat && pSrc->repeatType != RepeatNormal) ||
+ (pMask && pMask->repeat && pMask->repeatType != RepeatNormal))
+ {
+ return FALSE;
+ }
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if(pMask) {
+ if(pMask->componentAlpha)
+ return FALSE;
+
+ /* for now we only do it if there is a 1x1 (solid) source */
+
+ if((pSrc->pDrawable->width == 1) && (pSrc->pDrawable->height == 1)) {
+ CARD16 red, green, blue, alpha;
+ CARD32 pixel =
+ *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr));
+
+ if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format))
+ return FALSE;
+
+ xMask += pMask->pDrawable->x;
+ yMask += pMask->pDrawable->y;
+
+ /* pull out color expandable operations here */
+ if((pMask->format == PICT_a1) && (alpha == 0xffff) &&
+ (op == PictOpOver) && infoRec->WriteBitmap && !pMask->repeat &&
+ !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) &&
+ (!(infoRec->WriteBitmapFlags & RGB_EQUAL) ||
+ ((red == green) && (green == blue))))
+ {
+ PixmapPtr pPix = (PixmapPtr)(pMask->pDrawable);
+ int skipleft;
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox)
+ return TRUE;
+
+ XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format);
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while(nbox--) {
+ skipleft = pbox->x1 + xMask;
+
+ (*infoRec->WriteBitmap)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1,
+ (unsigned char*)(pPix->devPrivate.ptr) +
+ (pPix->devKind * (pbox->y1 + yMask)) +
+ ((skipleft >> 3) & ~3), pPix->devKind,
+ skipleft & 31, pixel, -1, GXcopy, ~0);
+ pbox++;
+ }
+
+ /* WriteBitmap sets the Sync flag */
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+ formats = infoRec->CPUToScreenAlphaTextureFormats;
+ dstformats = infoRec->CPUToScreenAlphaTextureDstFormats;
+ if(!formats || !dstformats)
+ return FALSE;
+
+ w = pMask->pDrawable->width;
+ h = pMask->pDrawable->height;
+
+ if(pMask->repeat) {
+ if((infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_TILE) ||
+ ((infoRec->CPUToScreenAlphaTextureFlags &
+ XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
+ ((h & (h - 1)) || (w & (w - 1)))))
+ {
+ return FALSE;
+ }
+ flags |= XAA_RENDER_REPEAT;
+ }
+
+ if((alpha != 0xffff) &&
+ (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA))
+ return FALSE;
+
+ while(*formats != pMask->format) {
+ if(!(*formats)) return FALSE;
+ formats++;
+ }
+ while(*dstformats != pDst->format) {
+ if(!(*dstformats))
+ return FALSE;
+ dstformats++;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox) {
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+ if(!(infoRec->SetupForCPUToScreenAlphaTexture2)(infoRec->pScrn,
+ op, red, green, blue, alpha, pMask->format,
+ pDst->format,
+ ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr,
+ ((PixmapPtr)(pMask->pDrawable))->devKind,
+ w, h, flags))
+ {
+ REGION_UNINIT(pScreen, &region);
+ return FALSE;
+ }
+
+ xMask -= xDst;
+ yMask -= yDst;
+
+ while(nbox--) {
+ (*infoRec->SubsequentCPUToScreenAlphaTexture)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xMask, pbox->y1 + yMask,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+ } else {
+ formats = infoRec->CPUToScreenTextureFormats;
+ dstformats = infoRec->CPUToScreenTextureDstFormats;
+ if(!formats || !dstformats)
+ return FALSE;
+
+ w = pSrc->pDrawable->width;
+ h = pSrc->pDrawable->height;
+
+ if(pSrc->repeat) {
+ if((infoRec->CPUToScreenTextureFlags & XAA_RENDER_NO_TILE) ||
+ ((infoRec->CPUToScreenTextureFlags &
+ XAA_RENDER_POWER_OF_2_TILE_ONLY) &&
+ ((h & (h - 1)) || (w & (w - 1)))))
+ {
+ return FALSE;
+ }
+ flags |= XAA_RENDER_REPEAT;
+ }
+
+ while(*formats != pSrc->format) {
+ if(!(*formats)) return FALSE;
+ formats++;
+ }
+ while(*dstformats != pDst->format) {
+ if(!(*dstformats))
+ return FALSE;
+ dstformats++;
+ }
+
+ if (!miComputeCompositeRegion (&region, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ return TRUE;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox) {
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+ if(!(infoRec->SetupForCPUToScreenTexture2)(infoRec->pScrn,
+ op, pSrc->format, pDst->format,
+ ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr,
+ ((PixmapPtr)(pSrc->pDrawable))->devKind,
+ w, h, flags))
+ {
+ REGION_UNINIT(pScreen, &region);
+ return FALSE;
+ }
+
+
+ xSrc -= xDst;
+ ySrc -= yDst;
+
+ while(nbox--) {
+ (*infoRec->SubsequentCPUToScreenTexture)(infoRec->pScrn,
+ pbox->x1, pbox->y1,
+ pbox->x1 + xSrc, pbox->y1 + ySrc,
+ pbox->x2 - pbox->x1, pbox->y2 - pbox->y1);
+ pbox++;
+ }
+
+ SET_SYNC_FLAG(infoRec);
+ REGION_UNINIT(pScreen, &region);
+ return TRUE;
+ }
+
+
+ return FALSE;
+}
+
+static void
+XAACompositeSrcCopy (PicturePtr pSrc,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ int i, nbox;
+ int xoff, yoff;
+ BoxPtr pbox;
+ DDXPointPtr pptSrc;
+ RegionRec region;
+
+ xDst += pDst->pDrawable->x;
+ yDst += pDst->pDrawable->y;
+ xSrc += pSrc->pDrawable->x;
+ ySrc += pSrc->pDrawable->y;
+
+ if (!miComputeCompositeRegion (&region, pSrc, NULL, pDst,
+ xSrc, ySrc, 0, 0, xDst, yDst,
+ width, height))
+ return;
+
+ nbox = REGION_NUM_RECTS(&region);
+ pbox = REGION_RECTS(&region);
+
+ if(!nbox) {
+ REGION_UNINIT(pScreen, &region);
+ return;
+ }
+ pptSrc = malloc(sizeof(DDXPointRec) * nbox);
+ if (!pptSrc) {
+ REGION_UNINIT(pScreen, &region);
+ return;
+ }
+ xoff = xSrc - xDst;
+ yoff = ySrc - yDst;
+ for (i = 0; i < nbox; i++) {
+ pptSrc[i].x = pbox[i].x1 + xoff;
+ pptSrc[i].y = pbox[i].y1 + yoff;
+ }
+
+ infoRec->ScratchGC.planemask = ~0L;
+ infoRec->ScratchGC.alu = GXcopy;
+
+ XAADoBitBlt(pSrc->pDrawable, pDst->pDrawable, &infoRec->ScratchGC, &region,
+ pptSrc);
+
+ free(pptSrc);
+ REGION_UNINIT(pScreen, &region);
+ return;
+}
+
+void
+XAAComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAA_RENDER_PROLOGUE(pScreen, Composite);
+
+ if(!pMask && infoRec->pScrn->vtSema &&
+ infoRec->ScreenToScreenBitBlt &&
+ pSrc->pDrawable &&
+ DRAWABLE_IS_ON_CARD(pSrc->pDrawable) &&
+ DRAWABLE_IS_ON_CARD(pDst->pDrawable) &&
+ !pSrc->transform &&
+ (!pSrc->repeat || (xSrc >= 0 && ySrc >= 0 &&
+ xSrc+width<=pSrc->pDrawable->width &&
+ ySrc+height<=pSrc->pDrawable->height)) &&
+ ((op == PictOpSrc &&
+ ((pSrc->format==pDst->format) ||
+ (pSrc->format==PICT_a8r8g8b8 && pDst->format==PICT_x8r8g8b8) ||
+ (pSrc->format==PICT_a8b8g8r8 && pDst->format==PICT_x8b8g8r8))) ||
+ (op == PictOpOver && !pSrc->alphaMap && !pDst->alphaMap &&
+ pSrc->format==pDst->format &&
+ (pSrc->format==PICT_x8r8g8b8 || pSrc->format==PICT_x8b8g8r8))))
+ {
+ XAACompositeSrcCopy(pSrc, pDst, xSrc, ySrc, xDst, yDst, width, height);
+ } else if(!pSrc->pDrawable || (pMask && !pMask->pDrawable) ||
+ !infoRec->Composite ||
+ !(*infoRec->Composite)(op, pSrc, pMask, pDst,
+ xSrc, ySrc, xMask, yMask, xDst, yDst,
+ width, height))
+ {
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->pDrawable &&
+ (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
+ pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
+ SYNC_CHECK(pDst->pDrawable);
+ }
+ (*GetPictureScreen(pScreen)->Composite) (op,
+ pSrc,
+ pMask,
+ pDst,
+ xSrc,
+ ySrc,
+ xMask,
+ yMask,
+ xDst,
+ yDst,
+ width,
+ height);
+ }
+
+ if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
+
+ XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite);
+}
+
+Bool
+XAADoGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+
+ if(!REGION_NUM_RECTS(pDst->pCompositeClip))
+ return TRUE;
+
+ if(!infoRec->pScrn->vtSema ||
+ ((pDst->pDrawable->type != DRAWABLE_WINDOW) &&
+ !IS_OFFSCREEN_PIXMAP(pDst->pDrawable)))
+ return FALSE;
+
+ if((pSrc->pDrawable->type != DRAWABLE_PIXMAP) ||
+ IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))
+ return FALSE;
+
+ /*
+ * If it looks like we have a chance of being able to draw these
+ * glyphs with an accelerated Composite, do that now to avoid
+ * unneeded and costly syncs.
+ */
+ if(maskFormat) {
+ if(!infoRec->CPUToScreenAlphaTextureFormats)
+ return FALSE;
+ } else {
+ if(!infoRec->CPUToScreenTextureFormats)
+ return FALSE;
+ }
+
+ miGlyphs(op, pSrc, pDst, maskFormat, xSrc, ySrc, nlist, list, glyphs);
+
+ return TRUE;
+}
+
+
+void
+XAAGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCREEN(pScreen);
+ XAA_RENDER_PROLOGUE(pScreen, Glyphs);
+
+ if(!pSrc->pDrawable || !infoRec->Glyphs ||
+ !(*infoRec->Glyphs)(op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs))
+ {
+ if(infoRec->pScrn->vtSema &&
+ ((pSrc->pDrawable &&
+ (pSrc->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pSrc->pDrawable))) ||
+ pDst->pDrawable->type == DRAWABLE_WINDOW || IS_OFFSCREEN_PIXMAP(pDst->pDrawable))) {
+ SYNC_CHECK(pDst->pDrawable);
+ }
+ (*GetPictureScreen(pScreen)->Glyphs) (op, pSrc, pDst, maskFormat,
+ xSrc, ySrc, nlist, list, glyphs);
+ }
+
+ if(pDst->pDrawable->type == DRAWABLE_PIXMAP)
+ (XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst->pDrawable)))->flags |= DIRTY;
+
+ XAA_RENDER_EPILOGUE(pScreen, Glyphs, XAAGlyphs);
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaStateChange.c b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
index f33261453..9c98a32f2 100644
--- a/xorg-server/hw/xfree86/xaa/xaaStateChange.c
+++ b/xorg-server/hw/xfree86/xaa/xaaStateChange.c
@@ -1,1626 +1,1626 @@
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "windowstr.h"
-#include "xf86str.h"
-#include "mi.h"
-#include "miline.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaawrap.h"
-#include "servermd.h"
-
-#define XAA_STATE_WRAP(func) do {\
-if(infoRec->func) { \
- pStatePriv->func = infoRec->func;\
- infoRec->func = XAAStateWrap##func;\
-}} while(0)
-
-/* Wrap all XAA functions and allocate our private structure.
- */
-
-typedef struct _XAAStateWrapRec {
- ScrnInfoPtr pScrn;
- void (*RestoreAccelState)(ScrnInfoPtr pScrn);
- void (*Sync)(ScrnInfoPtr pScrn);
- void (*SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned int planemask,
- int trans_color);
- void (*SetupForSolidFill)(ScrnInfoPtr pScrn, int color, int rop,
- unsigned int planemask);
- void (*SetupForSolidLine)(ScrnInfoPtr pScrn,int color,int rop,
- unsigned int planemask);
- void (*SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern);
- void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top,
- int right, int bottom);
- void (*DisableClipping)(ScrnInfoPtr pScrn);
- void (*SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
- int fg, int bg, int rop,
- unsigned int planemask);
- void (*SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
- int rop, unsigned int planemask,
- int transparency_color);
- void (*SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg,
- int bg, int rop,
- unsigned int planemask);
- void (*SetupForScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
- void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask);
- void (*SetupForImageWrite)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth);
- void (*SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth);
- void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
- void (*ScreenToScreenBitBlt)(ScrnInfoPtr pScrn, int nbox,
- DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
- int ydir, int alu, unsigned int planmask);
- void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop, unsigned int planemask);
- void (*FillSolidRects)(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox);
- void (*FillMono8x8PatternRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int pat0, int pat1,
- int xorg, int yorg);
- void (*FillColor8x8PatternRects)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- XAACacheInfoPtr pCache);
- void (*FillCacheBltRects)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, XAACacheInfoPtr pCache);
- void (*FillColorExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- PixmapPtr pPix);
- void (*FillCacheExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, PixmapPtr pPix);
- void (*FillImageWriteRects)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, PixmapPtr pPix);
- void (*FillSolidSpans)(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int n, DDXPointPtr points,
- int *widths, int fSorted);
- void (*FillMono8x8PatternSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, int pat0, int pat1,
- int xorg, int yorg);
- void (*FillColor8x8PatternSpans)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg);
- void (*FillCacheBltSpans)(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n, DDXPointPtr points,
- int *widths, int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg);
- void (*FillColorExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths, int fSorted,
- int xorg, int yorg, PixmapPtr pPix);
- void (*FillCacheExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n, DDXPointPtr ppt,
- int *pwidth, int fSorted, int xorg, int yorg,
- PixmapPtr pPix);
- void (*TEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- int skipleft, int startline, unsigned int **glyphs,
- int glyphWidth, int fg, int bg, int rop,
- unsigned planemask);
- void (*NonTEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int n,
- NonTEGlyphPtr glyphs, BoxPtr pbox,
- int fg, int rop, unsigned int planemask);
- void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth);
- void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *dst, int dstwidth, int bpp, int depth);
- RegionPtr (*CopyArea)(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GC *pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty);
- RegionPtr (*CopyPlane)(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int width, int height, int dstx,
- int dsty, unsigned long bitPlane);
- void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap,
- DrawablePtr pDrawable, int dx, int dy, int xOrg,
- int yOrg);
- void (*PolyFillRectSolid)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit);
- void (*PolyFillRectStippled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit);
- void (*PolyFillRectOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC,
- int nrectFill, xRectangle *prectInit);
- void (*PolyFillRectTiled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit);
- void (*FillSpansSolid)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- void (*FillSpansStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- void (*FillSpansOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- void (*FillSpansTiled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted);
- int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars);
- int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- unsigned short *chars);
- void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars);
- void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
- void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
- void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase);
- int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars);
- int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
- void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars);
- void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars);
- void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
- void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase);
- void (*PolyRectangleThinSolid)(DrawablePtr pDrawable,GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit);
- void (*PolylinesWideSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts);
- void (*PolylinesThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts);
- void (*PolySegmentThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg);
- void (*PolylinesThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts);
- void (*PolySegmentThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg);
- void (*FillPolygonSolid)(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
- void (*FillPolygonStippled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
- void (*FillPolygonOpaqueStippled)(DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr ptsIn);
- void (*FillPolygonTiled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn);
- void (*PolyFillArcSolid)(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs);
- void (*PutImage)(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage);
- ValidateGCProcPtr ValidateFillSpans;
- ValidateGCProcPtr ValidateSetSpans;
- ValidateGCProcPtr ValidatePutImage;
- ValidateGCProcPtr ValidateCopyArea;
- ValidateGCProcPtr ValidateCopyPlane;
- ValidateGCProcPtr ValidatePolyPoint;
- ValidateGCProcPtr ValidatePolylines;
- ValidateGCProcPtr ValidatePolySegment;
- ValidateGCProcPtr ValidatePolyRectangle;
- ValidateGCProcPtr ValidatePolyArc;
- ValidateGCProcPtr ValidateFillPolygon;
- ValidateGCProcPtr ValidatePolyFillRect;
- ValidateGCProcPtr ValidatePolyFillArc;
- ValidateGCProcPtr ValidatePolyText8;
- ValidateGCProcPtr ValidatePolyText16;
- ValidateGCProcPtr ValidateImageText8;
- ValidateGCProcPtr ValidateImageText16;
- ValidateGCProcPtr ValidatePolyGlyphBlt;
- ValidateGCProcPtr ValidateImageGlyphBlt;
- ValidateGCProcPtr ValidatePushPixels;
- void (*ComputeDash)(GCPtr pGC);
- void (*InitPixmapCache)(ScreenPtr pScreen, RegionPtr areas, pointer data);
- void (*ClosePixmapCache)(ScreenPtr pScreen);
- int (*StippledFillChooser)(GCPtr pGC);
- int (*OpaqueStippledFillChooser)(GCPtr pGC);
- int (*TiledFillChooser)(GCPtr pGC);
- XAACacheInfoPtr (*CacheTile)(ScrnInfoPtr Scrn, PixmapPtr pPix);
- XAACacheInfoPtr (*CacheStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg,
- int bg);
- XAACacheInfoPtr (*CacheMonoStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix);
- XAACacheInfoPtr (*CacheMono8x8Pattern)(ScrnInfoPtr Scrn, int pat0,
- int pat1);
- XAACacheInfoPtr (*CacheColor8x8Pattern)(ScrnInfoPtr Scrn, PixmapPtr pPix,
- int fg, int bg);
- void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int fg,
- int bg);
- void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int bpp,
- int depth);
- void (*WriteMono8x8PatternToCache)(ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache);
- void (*WriteColor8x8PatternToCache)(ScrnInfoPtr pScrn, PixmapPtr pPix,
- XAACacheInfoPtr pCache);
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CopyWindowProcPtr CopyWindow;
- Bool (*SetupForCPUToScreenAlphaTexture2)(ScrnInfoPtr pScrn, int op,
- CARD16 red, CARD16 green,
- CARD16 blue, CARD16 alpha,
- CARD32 maskFormat, CARD32 dstFormat,
- CARD8 *alphaPtr, int alphaPitch,
- int width, int height, int flags);
- Bool (*SetupForCPUToScreenTexture2)(ScrnInfoPtr pScrn, int op,
- CARD32 srcFormat, CARD32 dstFormat,
- CARD8 *texPtr, int texPitch,
- int width, int height, int flags);
-} XAAStateWrapRec, *XAAStateWrapPtr;
-
-static int XAAStateKeyIndex;
-static DevPrivateKey XAAStateKey = &XAAStateKeyIndex;
-
-/* Wrap functions start here */
-#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
-
-#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
-
-#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
-(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
-
-#define STATE_CHECK_SP(pStatePriv) {\
- ScrnInfoPtr pScrn = pStatePriv->pScrn;\
- int i = 0;\
- int need_change = 0;\
- while(i < pScrn->numEntities) {\
- if(xf86IsEntityShared(pScrn->entityList[i]) &&\
- xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
- need_change = 1;\
- xf86SetLastScrnFlag(pScrn->entityList[i],\
- pScrn->scrnIndex);\
- }\
- i++;\
- }\
- if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
-}
-
-#define STATE_CHECK_PSCRN(pScrn) {\
- int i = 0;\
- int need_change = 0;\
- while(i < pScrn->numEntities) {\
- if(xf86IsEntityShared(pScrn->entityList[i]) &&\
- xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
- need_change = 1;\
- xf86SetLastScrnFlag(pScrn->entityList[i],\
- pScrn->scrnIndex);\
- }\
- i++;\
- }\
- if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
-}
-
-static void XAAStateWrapSync(ScrnInfoPtr pScrn)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->Sync)(pScrn);
-}
-
-static void XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
- int rop, unsigned int planemask,
- int trans_color)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, rop, planemask,
- trans_color);
-}
-
-static void XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForSolidFill)(pScrn, color, rop, planemask);
-}
-
-static void XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn,int color,int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForSolidLine)(pScrn, color, rop, planemask);
-}
-
-static void XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int length,
- unsigned char *pattern)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForDashedLine)(pScrn, fg, bg, rop, planemask, length, pattern);
-}
-
-static void XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top,
- int right, int bottom)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetClippingRectangle)(pScrn, left, top, right, bottom);
-}
-
-static void XAAStateWrapDisableClipping(ScrnInfoPtr pScrn)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->DisableClipping)(pScrn);
-}
-
-static void XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
- int fg, int bg, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForMono8x8PatternFill)(pScrn, patx, paty, fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
- int rop, unsigned int planemask,
- int transparency_color)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForColor8x8PatternFill)(pScrn, patx, paty, rop, planemask,
- transparency_color);
-}
-
-static void XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg,
- int bg, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg,
- int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop,
- planemask);
-}
-
-static void XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForImageWrite)(pScrn, rop, planemask, transparency_color, bpp,
- depth);
-}
-
-static void XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForScanlineImageWrite)(pScrn, rop, planemask, transparency_color,
- bpp, depth);
-}
-
-static void XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->SetupForImageRead)(pScrn, bpp, depth);
-}
-
-static void XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
- DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
- int ydir, int alu, unsigned int planmask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->ScreenToScreenBitBlt)(pScrn, nbox,
- pptSrc, pbox, xdir,
- ydir, alu, planmask);
-}
-
-static void XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int skipleft,
- int fg, int bg, int rop, unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteBitmap)(pScrn, x, y, w, h,
- src, srcwidth, skipleft,
- fg, bg, rop, planemask);
-}
-
-static void XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillSolidRects)(pScrn, fg, rop,
- planemask, nBox, pBox);
-}
-
-static void XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg,
- int rop, unsigned int planemask, int nBox,
- BoxPtr pBox, int pat0, int pat1,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillMono8x8PatternRects)(pScrn, fg, bg,
- rop, planemask, nBox,
- pBox, pat0, pat1,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColor8x8PatternRects)(pScrn, rop,
- planemask, nBox,
- pBox, xorg, yorg,
- pCache);
-}
-
-static void XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheBltRects)(pScrn, rop,
- planemask, nBox, pBox,
- xorg, yorg, pCache);
-}
-
-static void XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColorExpandRects)(pScrn, fg, bg, rop,
- planemask, nBox,
- pBox, xorg, yorg,
- pPix);
-}
-
-static void XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int nBox,
- BoxPtr pBox, int xorg, int yorg,
- PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheExpandRects)(pScrn, fg, bg, rop,
- planemask, nBox,
- pBox, xorg, yorg,
- pPix);
-}
-
-static void XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int nBox, BoxPtr pBox,
- int xorg, int yorg, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillImageWriteRects)(pScrn, rop,
- planemask, nBox, pBox,
- xorg, yorg, pPix);
-}
-
-static void XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop,
- unsigned int planemask, int n, DDXPointPtr points,
- int *widths, int fSorted)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillSolidSpans)(pScrn, fg, rop,
- planemask, n, points,
- widths, fSorted);
-}
-
-static void XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg,
- int rop, unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, int pat0, int pat1,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillMono8x8PatternSpans)(pScrn, fg, bg,
- rop, planemask, n,
- points, widths,
- fSorted, pat0, pat1,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColor8x8PatternSpans)(pScrn, rop,
- planemask, n,
- points, widths,
- fSorted, pCache,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths,
- int fSorted, XAACacheInfoPtr pCache,
- int xorg, int yorg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheBltSpans)(pScrn, rop,
- planemask, n,
- points, widths,
- fSorted, pCache,
- xorg, yorg);
-}
-
-static void XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr points, int *widths, int fSorted,
- int xorg, int yorg, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillColorExpandSpans)(pScrn, fg, bg, rop,
- planemask, n,
- points, widths, fSorted,
- xorg, yorg, pPix);
-}
-
-static void XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
- unsigned int planemask, int n,
- DDXPointPtr ppt, int *pwidth, int fSorted,
- int xorg, int yorg, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->FillCacheExpandSpans)(pScrn, fg, bg, rop,
- planemask, n,
- ppt, pwidth, fSorted,
- xorg, yorg, pPix);
-}
-
-static void XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- int skipleft, int startline,
- unsigned int **glyphs,
- int glyphWidth, int fg, int bg, int rop,
- unsigned planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->TEGlyphRenderer)(pScrn, x, y, w, h,
- skipleft, startline,
- glyphs,
- glyphWidth, fg, bg, rop,
- planemask);
-}
-
-static void XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
- NonTEGlyphPtr glyphs, BoxPtr pbox,
- int fg, int rop, unsigned int planemask)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->NonTEGlyphRenderer)(pScrn, x, y, n,
- glyphs, pbox,
- fg, rop, planemask);
-}
-
-static void XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int rop,
- unsigned int planemask, int transparency_color,
- int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WritePixmap)(pScrn, x, y, w, h,
- src, srcwidth, rop,
- planemask, transparency_color,
- bpp, depth);
-}
-
-static void XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *dst, int dstwidth, int bpp, int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->ReadPixmap)(pScrn, x, y, w, h,
- dst, dstwidth, bpp, depth);
-}
-
-static RegionPtr XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
- GC *pGC, int srcx, int srcy, int width, int height,
- int dstx, int dsty)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->CopyArea)(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height,
- dstx, dsty);
-}
-
-static RegionPtr XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
- int srcx, int srcy, int width, int height,
- int dstx, int dsty, unsigned long bitPlane)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->CopyPlane)(pSrc, pDst, pGC,
- srcx, srcy, width, height,
- dstx, dsty, bitPlane);
-}
-
-static void XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap,
- DrawablePtr pDrawable, int dx, int dy, int xOrg,
- int yOrg)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PushPixelsSolid)(pGC, pBitMap,
- pDrawable, dx, dy, xOrg,
- yOrg);
-}
-
-static void XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectSolid)(pDraw, pGC, nrectFill,
- prectInit);
-}
-
-static void XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectStippled)(pDraw, pGC, nrectFill,
- prectInit);
-}
-
-static void XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC,
- int nrectFill, xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectOpaqueStippled)(pDraw, pGC,
- nrectFill, prectInit);
-}
-
-static void XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
- xRectangle *prectInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillRectTiled)(pDraw, pGC, nrectFill,
- prectInit);
-}
-
-static void XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansSolid)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static void XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansStippled)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static void XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansOpaqueStippled)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static void XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit,
- DDXPointPtr ppt, int *pwidth, int fSorted)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillSpansTiled)(pDraw, pGC, nInit,
- ppt, pwidth, fSorted);
-}
-
-static int XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText8TE)(pDraw, pGC, x, y, count,
- chars);
-}
-
-static int XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
- unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText16TE)(pDraw, pGC, x, y, count,
- chars);
-}
-
-static void XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText8TE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText16TE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageGlyphBltTE)(pDrawable, pGC, xInit,
- yInit, nglyph, ppci,
- pglyphBase);
-}
-
-static void XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph, CharInfoPtr *ppci,
- pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyGlyphBltTE)(pDrawable, pGC, xInit,
- yInit, nglyph, ppci,
- pglyphBase);
-}
-
-static int XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText8NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static int XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->PolyText16NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, char *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText8NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
- int count, unsigned short *chars)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageText16NonTE)(pDraw, pGC, x, y,
- count, chars);
-}
-
-static void XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ImageGlyphBltNonTE)(pDrawable, pGC, xInit,
- yInit, nglyph,
- ppci, pglyphBase);
-}
-
-static void XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
- int yInit, unsigned int nglyph,
- CharInfoPtr *ppci, pointer pglyphBase)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyGlyphBltNonTE)(pDrawable, pGC, xInit,
- yInit, nglyph,
- ppci, pglyphBase);
-}
-
-static void XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable,GCPtr pGC,
- int nRectsInit, xRectangle *pRectsInit)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyRectangleThinSolid)(pDrawable, pGC,
- nRectsInit, pRectsInit);
-}
-
-static void XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolylinesWideSolid)(pDrawable, pGC, mode,
- npt, pPts);
-}
-
-static void XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolylinesThinSolid)(pDrawable, pGC, mode,
- npt, pPts);
-}
-
-static void XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolySegmentThinSolid)(pDrawable, pGC, nseg,
- pSeg);
-}
-
-static void XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode,
- int npt, DDXPointPtr pPts)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolylinesThinDashed)(pDrawable, pGC, mode,
- npt, pPts);
-}
-
-static void XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg,
- xSegment *pSeg)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolySegmentThinDashed)(pDrawable, pGC, nseg,
- pSeg);
-}
-
-static void XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonSolid)(pDrawable, pGC, shape,
- mode, count, ptsIn);
-}
-
-static void XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonStippled)(pDrawable, pGC, shape,
- mode, count, ptsIn);
-}
-
-static void XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC,
- int shape, int mode, int count,
- DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonOpaqueStippled)(pDrawable, pGC,
- shape, mode, count,
- ptsIn);
-}
-
-static void XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape,
- int mode, int count, DDXPointPtr ptsIn)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->FillPolygonTiled)(pDrawable, pGC, shape,
- mode, count, ptsIn);
-}
-
-static void XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs,
- xArc *parcs)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PolyFillArcSolid)(pDraw, pGC, narcs,
- parcs);
-}
-
-static void XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
- int w, int h, int leftPad, int format, char *pImage)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->PutImage)(pDraw, pGC, depth, x, y,
- w, h, leftPad, format, pImage);
-}
-
-static void XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateFillSpans)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateSetSpans)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePutImage)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateCopyArea)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateCopyPlane)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyPoint)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolylines)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolySegment)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyRectangle)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyArc)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateFillPolygon)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyFillRect)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyFillArc)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyText8)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyText16)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateImageText8)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidateImageText16)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePolyGlyphBlt)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
- (*pStatePriv->ValidateImageGlyphBlt)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes,
- DrawablePtr pDraw)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ValidatePushPixels)(pGC, changes,
- pDraw);
-}
-
-static void XAAStateWrapComputeDash(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ComputeDash)(pGC);
-}
-
-static void XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas,
- pointer data)
-{
- GET_STATEPRIV_SCREEN(pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->InitPixmapCache)(pScreen, areas,
- data);
-}
-
-static void XAAStateWrapClosePixmapCache(ScreenPtr pScreen)
-{
- GET_STATEPRIV_SCREEN(pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->ClosePixmapCache)(pScreen);
-}
-
-static int XAAStateWrapStippledFillChooser(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->StippledFillChooser)(pGC);
-}
-
-static int XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->OpaqueStippledFillChooser)(pGC);
-}
-
-static int XAAStateWrapTiledFillChooser(GCPtr pGC)
-{
- GET_STATEPRIV_GC(pGC);
- STATE_CHECK_SP(pStatePriv);
-
- return (*pStatePriv->TiledFillChooser)(pGC);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheTile)(pScrn, pPix);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg,
- int bg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheStipple)(pScrn, pPix, fg,
- bg);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheMonoStipple)(pScrn, pPix);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0,
- int pat1)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheMono8x8Pattern)(pScrn, pat0,
- pat1);
-}
-
-static XAACacheInfoPtr XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix,
- int fg, int bg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->CacheColor8x8Pattern)(pScrn, pPix,
- fg, bg);
-}
-
-static void XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int fg,
- int bg)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteBitmapToCache)(pScrn, x, y, w, h,
- src, srcwidth, fg,
- bg);
-}
-
-static void XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
- unsigned char *src, int srcwidth, int bpp,
- int depth)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WritePixmapToCache)(pScrn, x, y, w, h,
- src, srcwidth, bpp,
- depth);
-}
-
-static void XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn,
- XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteMono8x8PatternToCache)(pScrn,
- pCache);
-}
-
-static void XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix,
- XAACacheInfoPtr pCache)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- (*pStatePriv->WriteColor8x8PatternToCache)(pScrn, pPix,
- pCache);
-}
-
-static void XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
- unsigned int format,unsigned long planeMask,
- char *pdstLine)
-{
- GET_STATEPRIV_SCREEN(pDrawable->pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->GetImage)(pDrawable, sx, sy, w, h,
- format, planeMask,
- pdstLine);
-}
-
-static void XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
- int *pwidth, int nspans, char *pdstStart)
-{
- GET_STATEPRIV_SCREEN(pDrawable->pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->GetSpans)(pDrawable, wMax, ppt,
- pwidth, nspans, pdstStart);
-}
-
-static void XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen);
- STATE_CHECK_SP(pStatePriv);
-
- (*pStatePriv->CopyWindow)(pWindow, ptOldOrg,
- prgnSrc);
-}
-
-static Bool XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
- int op, CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 srcFormat,
- CARD32 dstFormat,
- CARD8 *alphaPtr,
- int alphaPitch,
- int width, int height,
- int flags)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->SetupForCPUToScreenAlphaTexture2)(pScrn, op, red, green,
- blue, alpha, srcFormat,
- dstFormat, alphaPtr,
- alphaPitch, width,
- height, flags);
-}
-
-static Bool XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
- CARD32 srcFormat,
- CARD32 dstFormat,
- CARD8 *texPtr, int texPitch,
- int width, int height,
- int flags)
-{
- GET_STATEPRIV_PSCRN(pScrn);
- STATE_CHECK_PSCRN(pScrn);
-
- return (*pStatePriv->SetupForCPUToScreenTexture2)(pScrn, op, srcFormat,
- dstFormat, texPtr, texPitch,
- width, height, flags);
-}
-
-/* Setup Function */
-Bool
-XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
-{
- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
- XAAStateWrapPtr pStatePriv;
- int i = 0;
-
- if(!(pStatePriv = xalloc(sizeof(XAAStateWrapRec)))) return FALSE;
- dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
- pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
- pStatePriv->pScrn = pScrn;
-
- /* Initialize the last screen to -1 so whenever an accel function
- * is called the proper state is setup
- */
- while(i < pScrn->numEntities) {
- xf86SetLastScrnFlag(pScrn->entityList[i], -1);
- i++;
- }
-/* Do the wrapping */
- XAA_STATE_WRAP(Sync);
- XAA_STATE_WRAP(SetupForScreenToScreenCopy);
- XAA_STATE_WRAP(SetupForSolidFill);
- XAA_STATE_WRAP(SetupForSolidLine);
- XAA_STATE_WRAP(SetupForDashedLine);
- XAA_STATE_WRAP(SetClippingRectangle);
- XAA_STATE_WRAP(DisableClipping);
- XAA_STATE_WRAP(SetupForMono8x8PatternFill);
- XAA_STATE_WRAP(SetupForColor8x8PatternFill);
- XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill);
- XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill);
- XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill);
- XAA_STATE_WRAP(SetupForImageWrite);
- XAA_STATE_WRAP(SetupForScanlineImageWrite);
- XAA_STATE_WRAP(SetupForImageRead);
- XAA_STATE_WRAP(ScreenToScreenBitBlt);
- XAA_STATE_WRAP(WriteBitmap);
- XAA_STATE_WRAP(FillSolidRects);
- XAA_STATE_WRAP(FillMono8x8PatternRects);
- XAA_STATE_WRAP(FillColor8x8PatternRects);
- XAA_STATE_WRAP(FillCacheBltRects);
- XAA_STATE_WRAP(FillColorExpandRects);
- XAA_STATE_WRAP(FillCacheExpandRects);
- XAA_STATE_WRAP(FillImageWriteRects);
- XAA_STATE_WRAP(FillSolidSpans);
- XAA_STATE_WRAP(FillMono8x8PatternSpans);
- XAA_STATE_WRAP(FillColor8x8PatternSpans);
- XAA_STATE_WRAP(FillCacheBltSpans);
- XAA_STATE_WRAP(FillColorExpandSpans);
- XAA_STATE_WRAP(FillCacheExpandSpans);
- XAA_STATE_WRAP(TEGlyphRenderer);
- XAA_STATE_WRAP(NonTEGlyphRenderer);
- XAA_STATE_WRAP(WritePixmap);
- XAA_STATE_WRAP(ReadPixmap);
- XAA_STATE_WRAP(CopyArea);
- XAA_STATE_WRAP(CopyPlane);
- XAA_STATE_WRAP(PushPixelsSolid);
- XAA_STATE_WRAP(PolyFillRectSolid);
- XAA_STATE_WRAP(PolyFillRectStippled);
- XAA_STATE_WRAP(PolyFillRectOpaqueStippled);
- XAA_STATE_WRAP(PolyFillRectTiled);
- XAA_STATE_WRAP(FillSpansSolid);
- XAA_STATE_WRAP(FillSpansStippled);
- XAA_STATE_WRAP(FillSpansOpaqueStippled);
- XAA_STATE_WRAP(FillSpansTiled);
- XAA_STATE_WRAP(PolyText8TE);
- XAA_STATE_WRAP(PolyText16TE);
- XAA_STATE_WRAP(ImageText8TE);
- XAA_STATE_WRAP(ImageText16TE);
- XAA_STATE_WRAP(ImageGlyphBltTE);
- XAA_STATE_WRAP(PolyGlyphBltTE);
- XAA_STATE_WRAP(PolyText8NonTE);
- XAA_STATE_WRAP(PolyText16NonTE);
- XAA_STATE_WRAP(ImageText8NonTE);
- XAA_STATE_WRAP(ImageText16NonTE);
- XAA_STATE_WRAP(ImageGlyphBltNonTE);
- XAA_STATE_WRAP(PolyGlyphBltNonTE);
- XAA_STATE_WRAP(PolyRectangleThinSolid);
- XAA_STATE_WRAP(PolylinesWideSolid);
- XAA_STATE_WRAP(PolylinesThinSolid);
- XAA_STATE_WRAP(PolySegmentThinSolid);
- XAA_STATE_WRAP(PolylinesThinDashed);
- XAA_STATE_WRAP(PolySegmentThinDashed);
- XAA_STATE_WRAP(FillPolygonSolid);
- XAA_STATE_WRAP(FillPolygonStippled);
- XAA_STATE_WRAP(FillPolygonOpaqueStippled);
- XAA_STATE_WRAP(FillPolygonTiled);
- XAA_STATE_WRAP(PolyFillArcSolid);
- XAA_STATE_WRAP(PutImage);
- XAA_STATE_WRAP(ValidateFillSpans);
- XAA_STATE_WRAP(ValidateSetSpans);
- XAA_STATE_WRAP(ValidatePutImage);
- XAA_STATE_WRAP(ValidateCopyArea);
- XAA_STATE_WRAP(ValidateCopyPlane);
- XAA_STATE_WRAP(ValidatePolyPoint);
- XAA_STATE_WRAP(ValidatePolylines);
- XAA_STATE_WRAP(ValidatePolySegment);
- XAA_STATE_WRAP(ValidatePolyRectangle);
- XAA_STATE_WRAP(ValidatePolyArc);
- XAA_STATE_WRAP(ValidateFillPolygon);
- XAA_STATE_WRAP(ValidatePolyFillRect);
- XAA_STATE_WRAP(ValidatePolyFillArc);
- XAA_STATE_WRAP(ValidatePolyText8);
- XAA_STATE_WRAP(ValidatePolyText16);
- XAA_STATE_WRAP(ValidateImageText8);
- XAA_STATE_WRAP(ValidateImageText16);
- XAA_STATE_WRAP(ValidatePolyGlyphBlt);
- XAA_STATE_WRAP(ValidateImageGlyphBlt);
- XAA_STATE_WRAP(ValidatePushPixels);
- XAA_STATE_WRAP(ComputeDash);
- XAA_STATE_WRAP(InitPixmapCache);
- XAA_STATE_WRAP(ClosePixmapCache);
- XAA_STATE_WRAP(StippledFillChooser);
- XAA_STATE_WRAP(OpaqueStippledFillChooser);
- XAA_STATE_WRAP(TiledFillChooser);
- XAA_STATE_WRAP(CacheTile);
- XAA_STATE_WRAP(CacheStipple);
- XAA_STATE_WRAP(CacheMonoStipple);
- XAA_STATE_WRAP(CacheMono8x8Pattern);
- XAA_STATE_WRAP(CacheColor8x8Pattern);
- XAA_STATE_WRAP(WriteBitmapToCache);
- XAA_STATE_WRAP(WritePixmapToCache);
- XAA_STATE_WRAP(WriteMono8x8PatternToCache);
- XAA_STATE_WRAP(WriteColor8x8PatternToCache);
- XAA_STATE_WRAP(GetImage);
- XAA_STATE_WRAP(GetSpans);
- XAA_STATE_WRAP(CopyWindow);
- XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
- XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
- return TRUE;
-}
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include "scrnintstr.h"
+#include "pixmapstr.h"
+#include "windowstr.h"
+#include "xf86str.h"
+#include "mi.h"
+#include "miline.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaawrap.h"
+#include "servermd.h"
+
+#define XAA_STATE_WRAP(func) do {\
+if(infoRec->func) { \
+ pStatePriv->func = infoRec->func;\
+ infoRec->func = XAAStateWrap##func;\
+}} while(0)
+
+/* Wrap all XAA functions and allocate our private structure.
+ */
+
+typedef struct _XAAStateWrapRec {
+ ScrnInfoPtr pScrn;
+ void (*RestoreAccelState)(ScrnInfoPtr pScrn);
+ void (*Sync)(ScrnInfoPtr pScrn);
+ void (*SetupForScreenToScreenCopy)(ScrnInfoPtr pScrn, int xdir, int ydir,
+ int rop, unsigned int planemask,
+ int trans_color);
+ void (*SetupForSolidFill)(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask);
+ void (*SetupForSolidLine)(ScrnInfoPtr pScrn,int color,int rop,
+ unsigned int planemask);
+ void (*SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int length,
+ unsigned char *pattern);
+ void (*SetClippingRectangle) (ScrnInfoPtr pScrn, int left, int top,
+ int right, int bottom);
+ void (*DisableClipping)(ScrnInfoPtr pScrn);
+ void (*SetupForMono8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForColor8x8PatternFill)(ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask,
+ int transparency_color);
+ void (*SetupForCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn, int fg,
+ int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForScanlineCPUToScreenColorExpandFill)(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForScreenToScreenColorExpandFill) (ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask);
+ void (*SetupForImageWrite)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
+ void (*SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth);
+ void (*SetupForImageRead) (ScrnInfoPtr pScrn, int bpp, int depth);
+ void (*ScreenToScreenBitBlt)(ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
+ int ydir, int alu, unsigned int planmask);
+ void (*WriteBitmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask);
+ void (*FillSolidRects)(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox);
+ void (*FillMono8x8PatternRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int pat0, int pat1,
+ int xorg, int yorg);
+ void (*FillColor8x8PatternRects)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache);
+ void (*FillCacheBltRects)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache);
+ void (*FillColorExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix);
+ void (*FillCacheExpandRects)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillImageWriteRects)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillSolidSpans)(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted);
+ void (*FillMono8x8PatternSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, int pat0, int pat1,
+ int xorg, int yorg);
+ void (*FillColor8x8PatternSpans)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg);
+ void (*FillCacheBltSpans)(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg);
+ void (*FillColorExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix);
+ void (*FillCacheExpandSpans)(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n, DDXPointPtr ppt,
+ int *pwidth, int fSorted, int xorg, int yorg,
+ PixmapPtr pPix);
+ void (*TEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft, int startline, unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask);
+ void (*NonTEGlyphRenderer)(ScrnInfoPtr pScrn, int x, int y, int n,
+ NonTEGlyphPtr glyphs, BoxPtr pbox,
+ int fg, int rop, unsigned int planemask);
+ void (*WritePixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth);
+ void (*ReadPixmap) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth);
+ RegionPtr (*CopyArea)(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GC *pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty);
+ RegionPtr (*CopyPlane)(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height, int dstx,
+ int dsty, unsigned long bitPlane);
+ void (*PushPixelsSolid) (GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg,
+ int yOrg);
+ void (*PolyFillRectSolid)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*PolyFillRectStippled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*PolyFillRectOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit);
+ void (*PolyFillRectTiled)(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit);
+ void (*FillSpansSolid)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansOpaqueStippled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ void (*FillSpansTiled)(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted);
+ int (*PolyText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars);
+ int (*PolyText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars);
+ void (*ImageText8TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars);
+ void (*ImageText16TE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase);
+ void (*PolyGlyphBltTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase);
+ int (*PolyText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+ int (*PolyText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageText8NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars);
+ void (*ImageText16NonTE) (DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars);
+ void (*ImageGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+ void (*PolyGlyphBltNonTE) (DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase);
+ void (*PolyRectangleThinSolid)(DrawablePtr pDrawable,GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit);
+ void (*PolylinesWideSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolylinesThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolySegmentThinSolid)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg);
+ void (*PolylinesThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts);
+ void (*PolySegmentThinDashed)(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg);
+ void (*FillPolygonSolid)(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*FillPolygonStippled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*FillPolygonOpaqueStippled)(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr ptsIn);
+ void (*FillPolygonTiled)(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn);
+ void (*PolyFillArcSolid)(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs);
+ void (*PutImage)(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage);
+ ValidateGCProcPtr ValidateFillSpans;
+ ValidateGCProcPtr ValidateSetSpans;
+ ValidateGCProcPtr ValidatePutImage;
+ ValidateGCProcPtr ValidateCopyArea;
+ ValidateGCProcPtr ValidateCopyPlane;
+ ValidateGCProcPtr ValidatePolyPoint;
+ ValidateGCProcPtr ValidatePolylines;
+ ValidateGCProcPtr ValidatePolySegment;
+ ValidateGCProcPtr ValidatePolyRectangle;
+ ValidateGCProcPtr ValidatePolyArc;
+ ValidateGCProcPtr ValidateFillPolygon;
+ ValidateGCProcPtr ValidatePolyFillRect;
+ ValidateGCProcPtr ValidatePolyFillArc;
+ ValidateGCProcPtr ValidatePolyText8;
+ ValidateGCProcPtr ValidatePolyText16;
+ ValidateGCProcPtr ValidateImageText8;
+ ValidateGCProcPtr ValidateImageText16;
+ ValidateGCProcPtr ValidatePolyGlyphBlt;
+ ValidateGCProcPtr ValidateImageGlyphBlt;
+ ValidateGCProcPtr ValidatePushPixels;
+ void (*ComputeDash)(GCPtr pGC);
+ void (*InitPixmapCache)(ScreenPtr pScreen, RegionPtr areas, pointer data);
+ void (*ClosePixmapCache)(ScreenPtr pScreen);
+ int (*StippledFillChooser)(GCPtr pGC);
+ int (*OpaqueStippledFillChooser)(GCPtr pGC);
+ int (*TiledFillChooser)(GCPtr pGC);
+ XAACacheInfoPtr (*CacheTile)(ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr (*CacheStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg,
+ int bg);
+ XAACacheInfoPtr (*CacheMonoStipple)(ScrnInfoPtr Scrn, PixmapPtr pPix);
+ XAACacheInfoPtr (*CacheMono8x8Pattern)(ScrnInfoPtr Scrn, int pat0,
+ int pat1);
+ XAACacheInfoPtr (*CacheColor8x8Pattern)(ScrnInfoPtr Scrn, PixmapPtr pPix,
+ int fg, int bg);
+ void (*WriteBitmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg,
+ int bg);
+ void (*WritePixmapToCache) (ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp,
+ int depth);
+ void (*WriteMono8x8PatternToCache)(ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache);
+ void (*WriteColor8x8PatternToCache)(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ XAACacheInfoPtr pCache);
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+ Bool (*SetupForCPUToScreenAlphaTexture2)(ScrnInfoPtr pScrn, int op,
+ CARD16 red, CARD16 green,
+ CARD16 blue, CARD16 alpha,
+ CARD32 maskFormat, CARD32 dstFormat,
+ CARD8 *alphaPtr, int alphaPitch,
+ int width, int height, int flags);
+ Bool (*SetupForCPUToScreenTexture2)(ScrnInfoPtr pScrn, int op,
+ CARD32 srcFormat, CARD32 dstFormat,
+ CARD8 *texPtr, int texPitch,
+ int width, int height, int flags);
+} XAAStateWrapRec, *XAAStateWrapPtr;
+
+static int XAAStateKeyIndex;
+static DevPrivateKey XAAStateKey = &XAAStateKeyIndex;
+
+/* Wrap functions start here */
+#define GET_STATEPRIV_GC(pGC) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAStateKey)
+
+#define GET_STATEPRIV_SCREEN(pScreen) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAStateKey)
+
+#define GET_STATEPRIV_PSCRN(pScrn) XAAStateWrapPtr pStatePriv =\
+(XAAStateWrapPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAStateKey)
+
+#define STATE_CHECK_SP(pStatePriv) {\
+ ScrnInfoPtr pScrn = pStatePriv->pScrn;\
+ int i = 0;\
+ int need_change = 0;\
+ while(i < pScrn->numEntities) {\
+ if(xf86IsEntityShared(pScrn->entityList[i]) &&\
+ xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
+ need_change = 1;\
+ xf86SetLastScrnFlag(pScrn->entityList[i],\
+ pScrn->scrnIndex);\
+ }\
+ i++;\
+ }\
+ if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
+}
+
+#define STATE_CHECK_PSCRN(pScrn) {\
+ int i = 0;\
+ int need_change = 0;\
+ while(i < pScrn->numEntities) {\
+ if(xf86IsEntityShared(pScrn->entityList[i]) &&\
+ xf86GetLastScrnFlag(pScrn->entityList[i]) != pScrn->scrnIndex) {\
+ need_change = 1;\
+ xf86SetLastScrnFlag(pScrn->entityList[i],\
+ pScrn->scrnIndex);\
+ }\
+ i++;\
+ }\
+ if(need_change == 1) (*pStatePriv->RestoreAccelState)(pScrn);\
+}
+
+static void XAAStateWrapSync(ScrnInfoPtr pScrn)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->Sync)(pScrn);
+}
+
+static void XAAStateWrapSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir,
+ int rop, unsigned int planemask,
+ int trans_color)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, rop, planemask,
+ trans_color);
+}
+
+static void XAAStateWrapSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForSolidFill)(pScrn, color, rop, planemask);
+}
+
+static void XAAStateWrapSetupForSolidLine(ScrnInfoPtr pScrn,int color,int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForSolidLine)(pScrn, color, rop, planemask);
+}
+
+static void XAAStateWrapSetupForDashedLine(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int length,
+ unsigned char *pattern)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForDashedLine)(pScrn, fg, bg, rop, planemask, length, pattern);
+}
+
+static void XAAStateWrapSetClippingRectangle(ScrnInfoPtr pScrn, int left, int top,
+ int right, int bottom)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetClippingRectangle)(pScrn, left, top, right, bottom);
+}
+
+static void XAAStateWrapDisableClipping(ScrnInfoPtr pScrn)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->DisableClipping)(pScrn);
+}
+
+static void XAAStateWrapSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForMono8x8PatternFill)(pScrn, patx, paty, fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapSetupForColor8x8PatternFill(ScrnInfoPtr pScrn, int patx, int paty,
+ int rop, unsigned int planemask,
+ int transparency_color)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForColor8x8PatternFill)(pScrn, patx, paty, rop, planemask,
+ transparency_color);
+}
+
+static void XAAStateWrapSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg,
+ int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForCPUToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScanlineCPUToScreenColorExpandFill)(pScrn, fg, bg, rop,
+ planemask);
+}
+
+static void XAAStateWrapSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScreenToScreenColorExpandFill)(pScrn, fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapSetupForImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForImageWrite)(pScrn, rop, planemask, transparency_color, bpp,
+ depth);
+}
+
+static void XAAStateWrapSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForScanlineImageWrite)(pScrn, rop, planemask, transparency_color,
+ bpp, depth);
+}
+
+static void XAAStateWrapSetupForImageRead(ScrnInfoPtr pScrn, int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->SetupForImageRead)(pScrn, bpp, depth);
+}
+
+static void XAAStateWrapScreenToScreenBitBlt(ScrnInfoPtr pScrn, int nbox,
+ DDXPointPtr pptSrc, BoxPtr pbox, int xdir,
+ int ydir, int alu, unsigned int planmask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->ScreenToScreenBitBlt)(pScrn, nbox,
+ pptSrc, pbox, xdir,
+ ydir, alu, planmask);
+}
+
+static void XAAStateWrapWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int skipleft,
+ int fg, int bg, int rop, unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteBitmap)(pScrn, x, y, w, h,
+ src, srcwidth, skipleft,
+ fg, bg, rop, planemask);
+}
+
+static void XAAStateWrapFillSolidRects(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillSolidRects)(pScrn, fg, rop,
+ planemask, nBox, pBox);
+}
+
+static void XAAStateWrapFillMono8x8PatternRects(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask, int nBox,
+ BoxPtr pBox, int pat0, int pat1,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillMono8x8PatternRects)(pScrn, fg, bg,
+ rop, planemask, nBox,
+ pBox, pat0, pat1,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillColor8x8PatternRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColor8x8PatternRects)(pScrn, rop,
+ planemask, nBox,
+ pBox, xorg, yorg,
+ pCache);
+}
+
+static void XAAStateWrapFillCacheBltRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheBltRects)(pScrn, rop,
+ planemask, nBox, pBox,
+ xorg, yorg, pCache);
+}
+
+static void XAAStateWrapFillColorExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColorExpandRects)(pScrn, fg, bg, rop,
+ planemask, nBox,
+ pBox, xorg, yorg,
+ pPix);
+}
+
+static void XAAStateWrapFillCacheExpandRects(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int nBox,
+ BoxPtr pBox, int xorg, int yorg,
+ PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheExpandRects)(pScrn, fg, bg, rop,
+ planemask, nBox,
+ pBox, xorg, yorg,
+ pPix);
+}
+
+static void XAAStateWrapFillImageWriteRects(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int nBox, BoxPtr pBox,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillImageWriteRects)(pScrn, rop,
+ planemask, nBox, pBox,
+ xorg, yorg, pPix);
+}
+
+static void XAAStateWrapFillSolidSpans(ScrnInfoPtr pScrn, int fg, int rop,
+ unsigned int planemask, int n, DDXPointPtr points,
+ int *widths, int fSorted)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillSolidSpans)(pScrn, fg, rop,
+ planemask, n, points,
+ widths, fSorted);
+}
+
+static void XAAStateWrapFillMono8x8PatternSpans(ScrnInfoPtr pScrn, int fg, int bg,
+ int rop, unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, int pat0, int pat1,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillMono8x8PatternSpans)(pScrn, fg, bg,
+ rop, planemask, n,
+ points, widths,
+ fSorted, pat0, pat1,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillColor8x8PatternSpans(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColor8x8PatternSpans)(pScrn, rop,
+ planemask, n,
+ points, widths,
+ fSorted, pCache,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillCacheBltSpans(ScrnInfoPtr pScrn, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths,
+ int fSorted, XAACacheInfoPtr pCache,
+ int xorg, int yorg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheBltSpans)(pScrn, rop,
+ planemask, n,
+ points, widths,
+ fSorted, pCache,
+ xorg, yorg);
+}
+
+static void XAAStateWrapFillColorExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr points, int *widths, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillColorExpandSpans)(pScrn, fg, bg, rop,
+ planemask, n,
+ points, widths, fSorted,
+ xorg, yorg, pPix);
+}
+
+static void XAAStateWrapFillCacheExpandSpans(ScrnInfoPtr pScrn, int fg, int bg, int rop,
+ unsigned int planemask, int n,
+ DDXPointPtr ppt, int *pwidth, int fSorted,
+ int xorg, int yorg, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->FillCacheExpandSpans)(pScrn, fg, bg, rop,
+ planemask, n,
+ ppt, pwidth, fSorted,
+ xorg, yorg, pPix);
+}
+
+static void XAAStateWrapTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ int skipleft, int startline,
+ unsigned int **glyphs,
+ int glyphWidth, int fg, int bg, int rop,
+ unsigned planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->TEGlyphRenderer)(pScrn, x, y, w, h,
+ skipleft, startline,
+ glyphs,
+ glyphWidth, fg, bg, rop,
+ planemask);
+}
+
+static void XAAStateWrapNonTEGlyphRenderer(ScrnInfoPtr pScrn, int x, int y, int n,
+ NonTEGlyphPtr glyphs, BoxPtr pbox,
+ int fg, int rop, unsigned int planemask)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->NonTEGlyphRenderer)(pScrn, x, y, n,
+ glyphs, pbox,
+ fg, rop, planemask);
+}
+
+static void XAAStateWrapWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int rop,
+ unsigned int planemask, int transparency_color,
+ int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WritePixmap)(pScrn, x, y, w, h,
+ src, srcwidth, rop,
+ planemask, transparency_color,
+ bpp, depth);
+}
+
+static void XAAStateWrapReadPixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *dst, int dstwidth, int bpp, int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->ReadPixmap)(pScrn, x, y, w, h,
+ dst, dstwidth, bpp, depth);
+}
+
+static RegionPtr XAAStateWrapCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GC *pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->CopyArea)(pSrcDrawable, pDstDrawable,
+ pGC, srcx, srcy, width, height,
+ dstx, dsty);
+}
+
+static RegionPtr XAAStateWrapCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC,
+ int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long bitPlane)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->CopyPlane)(pSrc, pDst, pGC,
+ srcx, srcy, width, height,
+ dstx, dsty, bitPlane);
+}
+
+static void XAAStateWrapPushPixelsSolid(GCPtr pGC, PixmapPtr pBitMap,
+ DrawablePtr pDrawable, int dx, int dy, int xOrg,
+ int yOrg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PushPixelsSolid)(pGC, pBitMap,
+ pDrawable, dx, dy, xOrg,
+ yOrg);
+}
+
+static void XAAStateWrapPolyFillRectSolid(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectSolid)(pDraw, pGC, nrectFill,
+ prectInit);
+}
+
+static void XAAStateWrapPolyFillRectStippled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectStippled)(pDraw, pGC, nrectFill,
+ prectInit);
+}
+
+static void XAAStateWrapPolyFillRectOpaqueStippled(DrawablePtr pDraw, GCPtr pGC,
+ int nrectFill, xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectOpaqueStippled)(pDraw, pGC,
+ nrectFill, prectInit);
+}
+
+static void XAAStateWrapPolyFillRectTiled(DrawablePtr pDraw, GCPtr pGC, int nrectFill,
+ xRectangle *prectInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillRectTiled)(pDraw, pGC, nrectFill,
+ prectInit);
+}
+
+static void XAAStateWrapFillSpansSolid(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansSolid)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void XAAStateWrapFillSpansStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansStippled)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void XAAStateWrapFillSpansOpaqueStippled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansOpaqueStippled)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static void XAAStateWrapFillSpansTiled(DrawablePtr pDraw, GCPtr pGC, int nInit,
+ DDXPointPtr ppt, int *pwidth, int fSorted)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillSpansTiled)(pDraw, pGC, nInit,
+ ppt, pwidth, fSorted);
+}
+
+static int XAAStateWrapPolyText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText8TE)(pDraw, pGC, x, y, count,
+ chars);
+}
+
+static int XAAStateWrapPolyText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count,
+ unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText16TE)(pDraw, pGC, x, y, count,
+ chars);
+}
+
+static void XAAStateWrapImageText8TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText8TE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageText16TE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText16TE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageGlyphBltTE)(pDrawable, pGC, xInit,
+ yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static void XAAStateWrapPolyGlyphBltTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph, CharInfoPtr *ppci,
+ pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyGlyphBltTE)(pDrawable, pGC, xInit,
+ yInit, nglyph, ppci,
+ pglyphBase);
+}
+
+static int XAAStateWrapPolyText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText8NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static int XAAStateWrapPolyText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->PolyText16NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageText8NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, char *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText8NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageText16NonTE(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageText16NonTE)(pDraw, pGC, x, y,
+ count, chars);
+}
+
+static void XAAStateWrapImageGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ImageGlyphBltNonTE)(pDrawable, pGC, xInit,
+ yInit, nglyph,
+ ppci, pglyphBase);
+}
+
+static void XAAStateWrapPolyGlyphBltNonTE(DrawablePtr pDrawable, GCPtr pGC, int xInit,
+ int yInit, unsigned int nglyph,
+ CharInfoPtr *ppci, pointer pglyphBase)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyGlyphBltNonTE)(pDrawable, pGC, xInit,
+ yInit, nglyph,
+ ppci, pglyphBase);
+}
+
+static void XAAStateWrapPolyRectangleThinSolid(DrawablePtr pDrawable,GCPtr pGC,
+ int nRectsInit, xRectangle *pRectsInit)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyRectangleThinSolid)(pDrawable, pGC,
+ nRectsInit, pRectsInit);
+}
+
+static void XAAStateWrapPolylinesWideSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesWideSolid)(pDrawable, pGC, mode,
+ npt, pPts);
+}
+
+static void XAAStateWrapPolylinesThinSolid(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesThinSolid)(pDrawable, pGC, mode,
+ npt, pPts);
+}
+
+static void XAAStateWrapPolySegmentThinSolid(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolySegmentThinSolid)(pDrawable, pGC, nseg,
+ pSeg);
+}
+
+static void XAAStateWrapPolylinesThinDashed(DrawablePtr pDrawable, GCPtr pGC, int mode,
+ int npt, DDXPointPtr pPts)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolylinesThinDashed)(pDrawable, pGC, mode,
+ npt, pPts);
+}
+
+static void XAAStateWrapPolySegmentThinDashed(DrawablePtr pDrawable, GCPtr pGC, int nseg,
+ xSegment *pSeg)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolySegmentThinDashed)(pDrawable, pGC, nseg,
+ pSeg);
+}
+
+static void XAAStateWrapFillPolygonSolid(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonSolid)(pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void XAAStateWrapFillPolygonStippled(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonStippled)(pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void XAAStateWrapFillPolygonOpaqueStippled(DrawablePtr pDrawable, GCPtr pGC,
+ int shape, int mode, int count,
+ DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonOpaqueStippled)(pDrawable, pGC,
+ shape, mode, count,
+ ptsIn);
+}
+
+static void XAAStateWrapFillPolygonTiled(DrawablePtr pDrawable, GCPtr pGC, int shape,
+ int mode, int count, DDXPointPtr ptsIn)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->FillPolygonTiled)(pDrawable, pGC, shape,
+ mode, count, ptsIn);
+}
+
+static void XAAStateWrapPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs,
+ xArc *parcs)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PolyFillArcSolid)(pDraw, pGC, narcs,
+ parcs);
+}
+
+static void XAAStateWrapPutImage(DrawablePtr pDraw, GCPtr pGC, int depth, int x, int y,
+ int w, int h, int leftPad, int format, char *pImage)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->PutImage)(pDraw, pGC, depth, x, y,
+ w, h, leftPad, format, pImage);
+}
+
+static void XAAStateWrapValidateFillSpans(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateFillSpans)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateSetSpans(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateSetSpans)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePutImage(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePutImage)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateCopyArea(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateCopyArea)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateCopyPlane(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateCopyPlane)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyPoint(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyPoint)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolylines(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolylines)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolySegment(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolySegment)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyRectangle(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyRectangle)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyArc(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyArc)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateFillPolygon(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateFillPolygon)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyFillRect(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyFillRect)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyFillArc(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyFillArc)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyText8(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyText8)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyText16(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyText16)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateImageText8(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateImageText8)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateImageText16(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidateImageText16)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePolyGlyphBlt(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePolyGlyphBlt)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidateImageGlyphBlt(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+ (*pStatePriv->ValidateImageGlyphBlt)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapValidatePushPixels(GCPtr pGC, unsigned long changes,
+ DrawablePtr pDraw)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ValidatePushPixels)(pGC, changes,
+ pDraw);
+}
+
+static void XAAStateWrapComputeDash(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ComputeDash)(pGC);
+}
+
+static void XAAStateWrapInitPixmapCache(ScreenPtr pScreen, RegionPtr areas,
+ pointer data)
+{
+ GET_STATEPRIV_SCREEN(pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->InitPixmapCache)(pScreen, areas,
+ data);
+}
+
+static void XAAStateWrapClosePixmapCache(ScreenPtr pScreen)
+{
+ GET_STATEPRIV_SCREEN(pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->ClosePixmapCache)(pScreen);
+}
+
+static int XAAStateWrapStippledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->StippledFillChooser)(pGC);
+}
+
+static int XAAStateWrapOpaqueStippledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->OpaqueStippledFillChooser)(pGC);
+}
+
+static int XAAStateWrapTiledFillChooser(GCPtr pGC)
+{
+ GET_STATEPRIV_GC(pGC);
+ STATE_CHECK_SP(pStatePriv);
+
+ return (*pStatePriv->TiledFillChooser)(pGC);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheTile(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheTile)(pScrn, pPix);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheStipple(ScrnInfoPtr pScrn, PixmapPtr pPix, int fg,
+ int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheStipple)(pScrn, pPix, fg,
+ bg);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheMonoStipple(ScrnInfoPtr pScrn, PixmapPtr pPix)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheMonoStipple)(pScrn, pPix);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheMono8x8Pattern(ScrnInfoPtr pScrn, int pat0,
+ int pat1)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheMono8x8Pattern)(pScrn, pat0,
+ pat1);
+}
+
+static XAACacheInfoPtr XAAStateWrapCacheColor8x8Pattern(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ int fg, int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->CacheColor8x8Pattern)(pScrn, pPix,
+ fg, bg);
+}
+
+static void XAAStateWrapWriteBitmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int fg,
+ int bg)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteBitmapToCache)(pScrn, x, y, w, h,
+ src, srcwidth, fg,
+ bg);
+}
+
+static void XAAStateWrapWritePixmapToCache(ScrnInfoPtr pScrn, int x, int y, int w, int h,
+ unsigned char *src, int srcwidth, int bpp,
+ int depth)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WritePixmapToCache)(pScrn, x, y, w, h,
+ src, srcwidth, bpp,
+ depth);
+}
+
+static void XAAStateWrapWriteMono8x8PatternToCache(ScrnInfoPtr pScrn,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteMono8x8PatternToCache)(pScrn,
+ pCache);
+}
+
+static void XAAStateWrapWriteColor8x8PatternToCache(ScrnInfoPtr pScrn, PixmapPtr pPix,
+ XAACacheInfoPtr pCache)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ (*pStatePriv->WriteColor8x8PatternToCache)(pScrn, pPix,
+ pCache);
+}
+
+static void XAAStateWrapGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format,unsigned long planeMask,
+ char *pdstLine)
+{
+ GET_STATEPRIV_SCREEN(pDrawable->pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->GetImage)(pDrawable, sx, sy, w, h,
+ format, planeMask,
+ pdstLine);
+}
+
+static void XAAStateWrapGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart)
+{
+ GET_STATEPRIV_SCREEN(pDrawable->pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->GetSpans)(pDrawable, wMax, ppt,
+ pwidth, nspans, pdstStart);
+}
+
+static void XAAStateWrapCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ GET_STATEPRIV_SCREEN(pWindow->drawable.pScreen);
+ STATE_CHECK_SP(pStatePriv);
+
+ (*pStatePriv->CopyWindow)(pWindow, ptOldOrg,
+ prgnSrc);
+}
+
+static Bool XAAStateWrapSetupForCPUToScreenAlphaTexture2(ScrnInfoPtr pScrn,
+ int op, CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *alphaPtr,
+ int alphaPitch,
+ int width, int height,
+ int flags)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->SetupForCPUToScreenAlphaTexture2)(pScrn, op, red, green,
+ blue, alpha, srcFormat,
+ dstFormat, alphaPtr,
+ alphaPitch, width,
+ height, flags);
+}
+
+static Bool XAAStateWrapSetupForCPUToScreenTexture2(ScrnInfoPtr pScrn, int op,
+ CARD32 srcFormat,
+ CARD32 dstFormat,
+ CARD8 *texPtr, int texPitch,
+ int width, int height,
+ int flags)
+{
+ GET_STATEPRIV_PSCRN(pScrn);
+ STATE_CHECK_PSCRN(pScrn);
+
+ return (*pStatePriv->SetupForCPUToScreenTexture2)(pScrn, op, srcFormat,
+ dstFormat, texPtr, texPitch,
+ width, height, flags);
+}
+
+/* Setup Function */
+Bool
+XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec)
+{
+ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+ XAAStateWrapPtr pStatePriv;
+ int i = 0;
+
+ if(!(pStatePriv = malloc(sizeof(XAAStateWrapRec)))) return FALSE;
+ dixSetPrivate(&pScreen->devPrivates, XAAStateKey, pStatePriv);
+ pStatePriv->RestoreAccelState = infoRec->RestoreAccelState;
+ pStatePriv->pScrn = pScrn;
+
+ /* Initialize the last screen to -1 so whenever an accel function
+ * is called the proper state is setup
+ */
+ while(i < pScrn->numEntities) {
+ xf86SetLastScrnFlag(pScrn->entityList[i], -1);
+ i++;
+ }
+/* Do the wrapping */
+ XAA_STATE_WRAP(Sync);
+ XAA_STATE_WRAP(SetupForScreenToScreenCopy);
+ XAA_STATE_WRAP(SetupForSolidFill);
+ XAA_STATE_WRAP(SetupForSolidLine);
+ XAA_STATE_WRAP(SetupForDashedLine);
+ XAA_STATE_WRAP(SetClippingRectangle);
+ XAA_STATE_WRAP(DisableClipping);
+ XAA_STATE_WRAP(SetupForMono8x8PatternFill);
+ XAA_STATE_WRAP(SetupForColor8x8PatternFill);
+ XAA_STATE_WRAP(SetupForCPUToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForScanlineCPUToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForScreenToScreenColorExpandFill);
+ XAA_STATE_WRAP(SetupForImageWrite);
+ XAA_STATE_WRAP(SetupForScanlineImageWrite);
+ XAA_STATE_WRAP(SetupForImageRead);
+ XAA_STATE_WRAP(ScreenToScreenBitBlt);
+ XAA_STATE_WRAP(WriteBitmap);
+ XAA_STATE_WRAP(FillSolidRects);
+ XAA_STATE_WRAP(FillMono8x8PatternRects);
+ XAA_STATE_WRAP(FillColor8x8PatternRects);
+ XAA_STATE_WRAP(FillCacheBltRects);
+ XAA_STATE_WRAP(FillColorExpandRects);
+ XAA_STATE_WRAP(FillCacheExpandRects);
+ XAA_STATE_WRAP(FillImageWriteRects);
+ XAA_STATE_WRAP(FillSolidSpans);
+ XAA_STATE_WRAP(FillMono8x8PatternSpans);
+ XAA_STATE_WRAP(FillColor8x8PatternSpans);
+ XAA_STATE_WRAP(FillCacheBltSpans);
+ XAA_STATE_WRAP(FillColorExpandSpans);
+ XAA_STATE_WRAP(FillCacheExpandSpans);
+ XAA_STATE_WRAP(TEGlyphRenderer);
+ XAA_STATE_WRAP(NonTEGlyphRenderer);
+ XAA_STATE_WRAP(WritePixmap);
+ XAA_STATE_WRAP(ReadPixmap);
+ XAA_STATE_WRAP(CopyArea);
+ XAA_STATE_WRAP(CopyPlane);
+ XAA_STATE_WRAP(PushPixelsSolid);
+ XAA_STATE_WRAP(PolyFillRectSolid);
+ XAA_STATE_WRAP(PolyFillRectStippled);
+ XAA_STATE_WRAP(PolyFillRectOpaqueStippled);
+ XAA_STATE_WRAP(PolyFillRectTiled);
+ XAA_STATE_WRAP(FillSpansSolid);
+ XAA_STATE_WRAP(FillSpansStippled);
+ XAA_STATE_WRAP(FillSpansOpaqueStippled);
+ XAA_STATE_WRAP(FillSpansTiled);
+ XAA_STATE_WRAP(PolyText8TE);
+ XAA_STATE_WRAP(PolyText16TE);
+ XAA_STATE_WRAP(ImageText8TE);
+ XAA_STATE_WRAP(ImageText16TE);
+ XAA_STATE_WRAP(ImageGlyphBltTE);
+ XAA_STATE_WRAP(PolyGlyphBltTE);
+ XAA_STATE_WRAP(PolyText8NonTE);
+ XAA_STATE_WRAP(PolyText16NonTE);
+ XAA_STATE_WRAP(ImageText8NonTE);
+ XAA_STATE_WRAP(ImageText16NonTE);
+ XAA_STATE_WRAP(ImageGlyphBltNonTE);
+ XAA_STATE_WRAP(PolyGlyphBltNonTE);
+ XAA_STATE_WRAP(PolyRectangleThinSolid);
+ XAA_STATE_WRAP(PolylinesWideSolid);
+ XAA_STATE_WRAP(PolylinesThinSolid);
+ XAA_STATE_WRAP(PolySegmentThinSolid);
+ XAA_STATE_WRAP(PolylinesThinDashed);
+ XAA_STATE_WRAP(PolySegmentThinDashed);
+ XAA_STATE_WRAP(FillPolygonSolid);
+ XAA_STATE_WRAP(FillPolygonStippled);
+ XAA_STATE_WRAP(FillPolygonOpaqueStippled);
+ XAA_STATE_WRAP(FillPolygonTiled);
+ XAA_STATE_WRAP(PolyFillArcSolid);
+ XAA_STATE_WRAP(PutImage);
+ XAA_STATE_WRAP(ValidateFillSpans);
+ XAA_STATE_WRAP(ValidateSetSpans);
+ XAA_STATE_WRAP(ValidatePutImage);
+ XAA_STATE_WRAP(ValidateCopyArea);
+ XAA_STATE_WRAP(ValidateCopyPlane);
+ XAA_STATE_WRAP(ValidatePolyPoint);
+ XAA_STATE_WRAP(ValidatePolylines);
+ XAA_STATE_WRAP(ValidatePolySegment);
+ XAA_STATE_WRAP(ValidatePolyRectangle);
+ XAA_STATE_WRAP(ValidatePolyArc);
+ XAA_STATE_WRAP(ValidateFillPolygon);
+ XAA_STATE_WRAP(ValidatePolyFillRect);
+ XAA_STATE_WRAP(ValidatePolyFillArc);
+ XAA_STATE_WRAP(ValidatePolyText8);
+ XAA_STATE_WRAP(ValidatePolyText16);
+ XAA_STATE_WRAP(ValidateImageText8);
+ XAA_STATE_WRAP(ValidateImageText16);
+ XAA_STATE_WRAP(ValidatePolyGlyphBlt);
+ XAA_STATE_WRAP(ValidateImageGlyphBlt);
+ XAA_STATE_WRAP(ValidatePushPixels);
+ XAA_STATE_WRAP(ComputeDash);
+ XAA_STATE_WRAP(InitPixmapCache);
+ XAA_STATE_WRAP(ClosePixmapCache);
+ XAA_STATE_WRAP(StippledFillChooser);
+ XAA_STATE_WRAP(OpaqueStippledFillChooser);
+ XAA_STATE_WRAP(TiledFillChooser);
+ XAA_STATE_WRAP(CacheTile);
+ XAA_STATE_WRAP(CacheStipple);
+ XAA_STATE_WRAP(CacheMonoStipple);
+ XAA_STATE_WRAP(CacheMono8x8Pattern);
+ XAA_STATE_WRAP(CacheColor8x8Pattern);
+ XAA_STATE_WRAP(WriteBitmapToCache);
+ XAA_STATE_WRAP(WritePixmapToCache);
+ XAA_STATE_WRAP(WriteMono8x8PatternToCache);
+ XAA_STATE_WRAP(WriteColor8x8PatternToCache);
+ XAA_STATE_WRAP(GetImage);
+ XAA_STATE_WRAP(GetSpans);
+ XAA_STATE_WRAP(CopyWindow);
+ XAA_STATE_WRAP(SetupForCPUToScreenAlphaTexture2);
+ XAA_STATE_WRAP(SetupForCPUToScreenTexture2);
+ return TRUE;
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c b/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
index 41e638e5c..049bb2cb3 100644
--- a/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
+++ b/xorg-server/hw/xfree86/xaa/xaaTEGlyph.c
@@ -1,1077 +1,1077 @@
-
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaacexp.h"
-#include "xf86.h"
-
-/* scanline function for TRIPLE_BITS_24BPP */
-static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width);
-
-/* Loop unrolled functions for common font widths */
-static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-
-
-#ifdef USEASSEMBLER
-# ifdef FIXEDBASE
-# ifdef MSBFIRST
-CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-# else
-CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base,
- unsigned int **glyphp, int line, int width, int glyphwidth);
-# endif
-# else
-# ifdef MSBFIRST
-CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-# else
-CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-# endif
-# endif
-#else
-static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp,
- int line, int width, int glyphwidth);
-#endif
-
-#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc)
-#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc)
-
-
-GlyphScanlineFuncPtr glyph_scanline_func[32] = {
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric,
-#ifdef USEASSEMBLER
-# ifdef FIXEDBASE
-# ifdef MSBFIRST
- DrawTETextScanlineWidth6PMSBFirstFixedBase,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PMSBFirstFixedBase,
- DrawTETextScanlineWidth9PMSBFirstFixedBase,
-# else
- DrawTETextScanlineWidth6PLSBFirstFixedBase,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PLSBFirstFixedBase,
- DrawTETextScanlineWidth9PLSBFirstFixedBase,
-# endif
-# else
-# ifdef MSBFIRST
- DrawTETextScanlineWidth6PMSBFirst,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PMSBFirst,
- DrawTETextScanlineWidth9PMSBFirst,
-# else
- DrawTETextScanlineWidth6PLSBFirst,
- DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8PLSBFirst,
- DrawTETextScanlineWidth9PLSBFirst,
-# endif
-# endif
-#else
- DrawTETextScanlineWidth6, DrawTETextScanlineWidth7,
- DrawTETextScanlineWidth8, DrawTETextScanlineWidth9,
-#endif
- DrawTETextScanlineWidth10,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth12,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth14,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth16,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth18,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineWidth24,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
- DrawTETextScanlineGeneric, DrawTETextScanlineGeneric
-};
-
-GlyphScanlineFuncPtr *glyph_get_scanline_func(void) {
- return glyph_scanline_func;
-}
-
-
-/********************************************************************
-
- Here we have TEGlyphRenders for a bunch of different color
- expansion types. The driver may provide its own renderer, but
- this is the default one which renders using lower-level primitives
- exported by the chipset driver.
-
-********************************************************************/
-
-/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not.
- A total of 4 versions */
-
-void
-EXPNAME(XAATEGlyphRenderer)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32* base;
- GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
- int dwords = 0;
-
- if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft &&
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (skipleft > x)))) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
-
- if(width > w) width = w;
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
- while(count--) {
- register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
- WRITE_BITS(tmp);
- }
-
- w -= width;
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((((width + 31) >> 5) * h) & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- w += skipleft;
- x -= skipleft;
- dwords = ((w + 31) >> 5) * h;
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
-#ifndef FIXEDBASE
- if((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
- while(h--) {
- base = (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
- }
- else
-#endif
- while(h--) {
- (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
- }
-
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- (dwords & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
-
-THE_END:
-
- if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-/********************************************************************
-
- This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer
- with the non FIXEDBASE LSB_FIRST code before tripling, and possibly
- reversing the bits and sending them to the screen
-
-********************************************************************/
-
-void
-EXPNAME(XAATEGlyphRenderer3)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- CARD32 *base, *mem;
- GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
- int dwords = 0;
-
- if((bg != -1) &&
- ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
- ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
- CARD32 bits;
-
- if(width > w) width = w;
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
- while(count--) {
- bits = SHIFT_R(glyphs[0][line++],skipleft);
- if (width >= 22) {
- WRITE_BITS3(bits);
- } else if (width >= 11) {
- WRITE_BITS2(bits);
- } else {
- WRITE_BITS1(bits);
- }
- }
-
- w -= width;
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- ((((3 * width + 31) >> 5) * h) & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- dwords = ((3 * w + 31) >> 5) * h;
- mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
- if (!mem) return;
-
- (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0);
-
- base = (CARD32*)infoRec->ColorExpandBase;
-
-# ifndef FIXEDBASE
- if((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
- while(h--) {
- (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
- base = DrawTextScanline3(base, mem, w);
- }
- else
-# endif
- while(h--) {
- (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
- DrawTextScanline3(base, mem, w);
- }
-
- xfree(mem);
-
- if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
- (dwords & 1)) {
- base = (CARD32*)infoRec->ColorExpandBase;
- base[0] = 0x00000000;
- }
-
-THE_END:
-
- if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
- (*infoRec->Sync)(pScrn);
- else SET_SYNC_FLAG(infoRec);
-}
-
-
-#ifndef FIXEDBASE
-/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
-
-void
-EXPNAME(XAATEGlyphRendererScanline)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int bufferNo;
- CARD32* base;
- GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
-
- if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft &&
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
- (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
- (skipleft > x)))) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
-
- if(width > w) width = w;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- bufferNo = 0;
-
- while(count--) {
- register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- WRITE_BITS(tmp);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
- w -= width;
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- w += skipleft;
- x -= skipleft;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
-
- bufferNo = 0;
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
-THE_END:
-
- SET_SYNC_FLAG(infoRec);
-}
-
-void
-EXPNAME(XAATEGlyphRendererScanline3)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-)
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int bufferNo;
- CARD32 *base, *mem;
- GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
-
- if((bg != -1) &&
- ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
- ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
- (!CHECK_RGB_EQUAL(bg))))) {
- (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
- (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
- bg = -1;
- }
-
- (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
- pScrn, fg, bg, rop, planemask);
-
- if(skipleft) {
- /* draw the first character only */
-
- int count = h, line = startline;
- int width = glyphWidth - skipleft;
- CARD32 bits;
-
- if(width > w) width = w;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, width, h, 0);
-
- bufferNo = 0;
-
- while(count--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- bits = SHIFT_R(glyphs[0][line++],skipleft);
- if (width >= 22) {
- WRITE_BITS3(bits);
- } else if (width >= 11) {
- WRITE_BITS2(bits);
- } else {
- WRITE_BITS1(bits);
- }
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
- w -= width;
- if(!w) goto THE_END;
- glyphs++;
- x += width;
- skipleft = 0; /* nicely aligned again */
- }
-
- w += skipleft;
- x -= skipleft;
- mem = (CARD32*)xalloc(((w + 31) >> 3) * sizeof(char));
- if (!mem) return;
-
- (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
- pScrn, x, y, w, h, skipleft);
-
- bufferNo = 0;
-
- while(h--) {
- base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
- (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
- DrawTextScanline3(base, mem, w);
- (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
- if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
- bufferNo = 0;
- }
-
- xfree(mem);
-
-THE_END:
-
- SET_SYNC_FLAG(infoRec);
-}
-
-#endif
-
-
-
-/********************************************************************
-
- TRIPLE_BITS_24BPP scanline rendering code.
-
-********************************************************************/
-
-
-
-static CARD32*
-DrawTextScanline3(
- CARD32 *base,
- CARD32 *mem,
- int width )
-{
-
- while(width > 32) {
- WRITE_BITS3(*mem);
- mem++;
- width -= 32;
- }
- if(width) {
- if (width >= 22) {
- WRITE_BITS3(*mem);
- } else if (width >= 11) {
- WRITE_BITS2(*mem);
- } else {
- WRITE_BITS1(*mem);
- }
- }
-
- return base;
-}
-
-
-/********************************************************************
-
- Generic TE scanline rendering code.
-
-********************************************************************/
-
-
-
-static CARD32*
-DrawTETextScanlineGeneric(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- CARD32 bits = (*glyphp)[line];
- int shift = glyphwidth;
-
- while(width > 32) {
- while(shift < 32) {
- glyphp++;
- bits |= SHIFT_L((*glyphp)[line], shift);
- shift += glyphwidth;
- }
- WRITE_BITS(bits);
- shift &= 31;
- if(shift)
- bits = SHIFT_R((*glyphp)[line],(glyphwidth - shift));
- else bits = 0;
- width -= 32;
- }
-
- if(width) {
- width -= shift;
- while(width > 0) {
- glyphp++;
- bits |= SHIFT_L((*glyphp)[line],shift);
- shift += glyphwidth;
- width -= glyphwidth;
- }
- WRITE_BITS(bits);
- }
-
- return base;
-}
-
-
-/********************************************************************
-
- Loop unrolled TE font scanline rendering code
-
-********************************************************************/
-
-
-#ifndef USEASSEMBLER
-static CARD32*
-DrawTETextScanlineWidth6(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],6);
- bits |= SHIFT_L(glyphp[2][line],12);
- bits |= SHIFT_L(glyphp[3][line],18);
- bits |= SHIFT_L(glyphp[4][line],24);
- bits |= SHIFT_L(glyphp[5][line],30);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[5][line],2);
- bits |= SHIFT_L(glyphp[6][line],4);
- bits |= SHIFT_L(glyphp[7][line],10);
- bits |= SHIFT_L(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],22);
- bits |= SHIFT_L(glyphp[10][line],28);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[10][line],4);
- bits |= SHIFT_L(glyphp[11][line],2);
- bits |= SHIFT_L(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],14);
- bits |= SHIFT_L(glyphp[14][line],20);
- bits |= SHIFT_L(glyphp[15][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
-#ifndef FIXEDBASE
- base += 3;
-#endif
- width -= 96;
- glyphp += 16;
- }
- return base;
-}
-#endif
-
-static CARD32*
-DrawTETextScanlineWidth7(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],7);
- bits |= SHIFT_L(glyphp[2][line],14);
- bits |= SHIFT_L(glyphp[3][line],21);
- bits |= SHIFT_L(glyphp[4][line],28);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[4][line],4);
- bits |= SHIFT_L(glyphp[5][line],3);
- bits |= SHIFT_L(glyphp[6][line],10);
- bits |= SHIFT_L(glyphp[7][line],17);
- bits |= SHIFT_L(glyphp[8][line],24);
- bits |= SHIFT_L(glyphp[9][line],31);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[9][line],1);
- bits |= SHIFT_L(glyphp[10][line],6);
- bits |= SHIFT_L(glyphp[11][line],13);
- bits |= SHIFT_L(glyphp[12][line],20);
- bits |= SHIFT_L(glyphp[13][line],27);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[13][line],5);
- bits |= SHIFT_L(glyphp[14][line],2);
- bits |= SHIFT_L(glyphp[15][line],9);
- bits |= SHIFT_L(glyphp[16][line],16);
- bits |= SHIFT_L(glyphp[17][line],23);
- bits |= SHIFT_L(glyphp[18][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[18][line],2);
- bits |= SHIFT_L(glyphp[19][line],5);
- bits |= SHIFT_L(glyphp[20][line],12);
- bits |= SHIFT_L(glyphp[21][line],19);
- bits |= SHIFT_L(glyphp[22][line],26);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[22][line],6);
- bits |= SHIFT_L(glyphp[23][line],1);
- bits |= SHIFT_L(glyphp[24][line],8);
- bits |= SHIFT_L(glyphp[25][line],15);
- bits |= SHIFT_L(glyphp[26][line],22);
- bits |= SHIFT_L(glyphp[27][line],29);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[27][line],3);
- bits |= SHIFT_L(glyphp[28][line],4);
- bits |= SHIFT_L(glyphp[29][line],11);
- bits |= SHIFT_L(glyphp[30][line],18);
- bits |= SHIFT_L(glyphp[31][line],25);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
-#ifndef FIXEDBASE
- base += 7;
-#endif
- width -= 224;
- glyphp += 32;
- }
- return base;
-}
-
-
-#ifndef USEASSEMBLER
-static CARD32*
-DrawTETextScanlineWidth8(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],8);
- bits |= SHIFT_L(glyphp[2][line],16);
- bits |= SHIFT_L(glyphp[3][line],24);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = glyphp[4][line];
- bits |= SHIFT_L(glyphp[5][line],8);
- bits |= SHIFT_L(glyphp[6][line],16);
- bits |= SHIFT_L(glyphp[7][line],24);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
-#ifndef FIXEDBASE
- base += 2;
-#endif
- width -= 64;
- glyphp += 8;
- }
- return base;
-}
-#endif
-
-#ifndef USEASSEMBLER
-static CARD32*
-DrawTETextScanlineWidth9(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],9);
- bits |= SHIFT_L(glyphp[2][line],18);
- bits |= SHIFT_L(glyphp[3][line],27);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[3][line],5);
- bits |= SHIFT_L(glyphp[4][line],4);
- bits |= SHIFT_L(glyphp[5][line],13);
- bits |= SHIFT_L(glyphp[6][line],22);
- bits |= SHIFT_L(glyphp[7][line],31);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[7][line],1);
- bits |= SHIFT_L(glyphp[8][line],8);
- bits |= SHIFT_L(glyphp[9][line],17);
- bits |= SHIFT_L(glyphp[10][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[10][line],6);
- bits |= SHIFT_L(glyphp[11][line],3);
- bits |= SHIFT_L(glyphp[12][line],12);
- bits |= SHIFT_L(glyphp[13][line],21);
- bits |= SHIFT_L(glyphp[14][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[14][line],2);
- bits |= SHIFT_L(glyphp[15][line],7);
- bits |= SHIFT_L(glyphp[16][line],16);
- bits |= SHIFT_L(glyphp[17][line],25);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[17][line],7);
- bits |= SHIFT_L(glyphp[18][line],2);
- bits |= SHIFT_L(glyphp[19][line],11);
- bits |= SHIFT_L(glyphp[20][line],20);
- bits |= SHIFT_L(glyphp[21][line],29);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[21][line],3);
- bits |= SHIFT_L(glyphp[22][line],6);
- bits |= SHIFT_L(glyphp[23][line],15);
- bits |= SHIFT_L(glyphp[24][line],24);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
- bits = SHIFT_R(glyphp[24][line],8);
- bits |= SHIFT_L(glyphp[25][line],1);
- bits |= SHIFT_L(glyphp[26][line],10);
- bits |= SHIFT_L(glyphp[27][line],19);
- bits |= SHIFT_L(glyphp[28][line],28);
- WRITE_IN_BITORDER(base, 7, bits);
- CHECKRETURN(8);
- bits = SHIFT_R(glyphp[28][line],4);
- bits |= SHIFT_L(glyphp[29][line],5);
- bits |= SHIFT_L(glyphp[30][line],14);
- bits |= SHIFT_L(glyphp[31][line],23);
- WRITE_IN_BITORDER(base, 8, bits);
- CHECKRETURN(9);
-#ifndef FIXEDBASE
- base += 9;
-#endif
- width -= 288;
- glyphp += 32;
- }
- return base;
-}
-#endif
-
-static CARD32*
-DrawTETextScanlineWidth10(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],10);
- bits |= SHIFT_L(glyphp[2][line],20);
- bits |= SHIFT_L(glyphp[3][line],30);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[3][line],2);
- bits |= SHIFT_L(glyphp[4][line],8);
- bits |= SHIFT_L(glyphp[5][line],18);
- bits |= SHIFT_L(glyphp[6][line],28);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[6][line],4);
- bits |= SHIFT_L(glyphp[7][line],6);
- bits |= SHIFT_L(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[9][line],6);
- bits |= SHIFT_L(glyphp[10][line],4);
- bits |= SHIFT_L(glyphp[11][line],14);
- bits |= SHIFT_L(glyphp[12][line],24);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],2);
- bits |= SHIFT_L(glyphp[14][line],12);
- bits |= SHIFT_L(glyphp[15][line],22);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
-#ifndef FIXEDBASE
- base += 5;
-#endif
- width -= 160;
- glyphp += 16;
- }
- return base;
-}
-
-static CARD32*
-DrawTETextScanlineWidth12(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],12);
- bits |= SHIFT_L(glyphp[2][line],24);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[2][line],8);
- bits |= SHIFT_L(glyphp[3][line],4);
- bits |= SHIFT_L(glyphp[4][line],16);
- bits |= SHIFT_L(glyphp[5][line],28);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[5][line],4);
- bits |= SHIFT_L(glyphp[6][line],8);
- bits |= SHIFT_L(glyphp[7][line],20);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
-#ifndef FIXEDBASE
- base += 3;
-#endif
- width -= 96;
- glyphp += 8;
- }
- return base;
-}
-
-
-
-static CARD32*
-DrawTETextScanlineWidth14(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],14);
- bits |= SHIFT_L(glyphp[2][line],28);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[2][line],4);
- bits |= SHIFT_L(glyphp[3][line],10);
- bits |= SHIFT_L(glyphp[4][line],24);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[4][line],8);
- bits |= SHIFT_L(glyphp[5][line],6);
- bits |= SHIFT_L(glyphp[6][line],20);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[6][line],12);
- bits |= SHIFT_L(glyphp[7][line],2);
- bits |= SHIFT_L(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[9][line],2);
- bits |= SHIFT_L(glyphp[10][line],12);
- bits |= SHIFT_L(glyphp[11][line],26);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[11][line],6);
- bits |= SHIFT_L(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],22);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[13][line],10);
- bits |= SHIFT_L(glyphp[14][line],4);
- bits |= SHIFT_L(glyphp[15][line],18);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
-#ifndef FIXEDBASE
- base += 7;
-#endif
- width -= 224;
- glyphp += 16;
- }
- return base;
-}
-
-
-static CARD32*
-DrawTETextScanlineWidth16(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],16);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = glyphp[2][line];
- bits |= SHIFT_L(glyphp[3][line],16);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = glyphp[4][line];
- bits |= SHIFT_L(glyphp[5][line],16);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = glyphp[6][line];
- bits |= SHIFT_L(glyphp[7][line],16);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
-#ifndef FIXEDBASE
- base += 4;
-#endif
- width -= 128;
- glyphp += 8;
- }
- return base;
-}
-
-
-
-static CARD32*
-DrawTETextScanlineWidth18(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],18);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[1][line],14);
- bits |= SHIFT_L(glyphp[2][line],4);
- bits |= SHIFT_L(glyphp[3][line],22);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[3][line],10);
- bits |= SHIFT_L(glyphp[4][line],8);
- bits |= SHIFT_L(glyphp[5][line],26);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
- bits = SHIFT_R(glyphp[5][line],6);
- bits |= SHIFT_L(glyphp[6][line],12);
- bits |= SHIFT_L(glyphp[7][line],30);
- WRITE_IN_BITORDER(base, 3, bits);
- CHECKRETURN(4);
- bits = SHIFT_R(glyphp[7][line],2);
- bits |= SHIFT_L(glyphp[8][line],16);
- WRITE_IN_BITORDER(base, 4, bits);
- CHECKRETURN(5);
- bits = SHIFT_R(glyphp[8][line],16);
- bits |= SHIFT_L(glyphp[9][line],2);
- bits |= SHIFT_L(glyphp[10][line],20);
- WRITE_IN_BITORDER(base, 5, bits);
- CHECKRETURN(6);
- bits = SHIFT_R(glyphp[10][line],12);
- bits |= SHIFT_L(glyphp[11][line],6);
- bits |= SHIFT_L(glyphp[12][line],24);
- WRITE_IN_BITORDER(base, 6, bits);
- CHECKRETURN(7);
- bits = SHIFT_R(glyphp[12][line],8);
- bits |= SHIFT_L(glyphp[13][line],10);
- bits |= SHIFT_L(glyphp[14][line],28);
- WRITE_IN_BITORDER(base, 7, bits);
- CHECKRETURN(8);
- bits = SHIFT_R(glyphp[14][line],4);
- bits |= SHIFT_L(glyphp[15][line],14);
- WRITE_IN_BITORDER(base, 8, bits);
- CHECKRETURN(9);
-#ifndef FIXEDBASE
- base += 9;
-#endif
- width -= 288;
- glyphp += 16;
- }
- return base;
-}
-
-
-static CARD32*
-DrawTETextScanlineWidth24(
- CARD32 *base,
- unsigned int **glyphp,
- int line, int width, int glyphwidth )
-{
- while (1) {
- unsigned int bits;
- bits = glyphp[0][line];
- bits |= SHIFT_L(glyphp[1][line],24);
- WRITE_IN_BITORDER(base, 0, bits);
- CHECKRETURN(1);
- bits = SHIFT_R(glyphp[1][line],8);
- bits |= SHIFT_L(glyphp[2][line],16);
- WRITE_IN_BITORDER(base, 1, bits);
- CHECKRETURN(2);
- bits = SHIFT_R(glyphp[2][line],16);
- bits |= SHIFT_L(glyphp[3][line],8);
- WRITE_IN_BITORDER(base, 2, bits);
- CHECKRETURN(3);
-#ifndef FIXEDBASE
- base += 3;
-#endif
- width -= 96;
- glyphp += 4;
- }
- return base;
-}
-
-
+
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaacexp.h"
+#include "xf86.h"
+
+/* scanline function for TRIPLE_BITS_24BPP */
+static CARD32 *DrawTextScanline3(CARD32 *base, CARD32 *mem, int width);
+
+/* Loop unrolled functions for common font widths */
+static CARD32 *DrawTETextScanlineGeneric(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth7(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth10(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth12(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth14(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth16(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth18(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth24(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+
+
+#ifdef USEASSEMBLER
+# ifdef FIXEDBASE
+# ifdef MSBFIRST
+CARD32 *DrawTETextScanlineWidth6PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PMSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+# else
+CARD32 *DrawTETextScanlineWidth6PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PLSBFirstFixedBase(CARD32 *base,
+ unsigned int **glyphp, int line, int width, int glyphwidth);
+# endif
+# else
+# ifdef MSBFIRST
+CARD32 *DrawTETextScanlineWidth6PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PMSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+# else
+CARD32 *DrawTETextScanlineWidth6PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth8PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+CARD32 *DrawTETextScanlineWidth9PLSBFirst(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+# endif
+# endif
+#else
+static CARD32 *DrawTETextScanlineWidth6(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth8(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+static CARD32 *DrawTETextScanlineWidth9(CARD32 *base, unsigned int **glyphp,
+ int line, int width, int glyphwidth);
+#endif
+
+#define glyph_scanline_func EXPNAME(XAAGlyphScanlineFunc)
+#define glyph_get_scanline_func EXPNAME(XAAGetGlyphScanlineFunc)
+
+
+GlyphScanlineFuncPtr glyph_scanline_func[32] = {
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric,
+#ifdef USEASSEMBLER
+# ifdef FIXEDBASE
+# ifdef MSBFIRST
+ DrawTETextScanlineWidth6PMSBFirstFixedBase,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PMSBFirstFixedBase,
+ DrawTETextScanlineWidth9PMSBFirstFixedBase,
+# else
+ DrawTETextScanlineWidth6PLSBFirstFixedBase,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PLSBFirstFixedBase,
+ DrawTETextScanlineWidth9PLSBFirstFixedBase,
+# endif
+# else
+# ifdef MSBFIRST
+ DrawTETextScanlineWidth6PMSBFirst,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PMSBFirst,
+ DrawTETextScanlineWidth9PMSBFirst,
+# else
+ DrawTETextScanlineWidth6PLSBFirst,
+ DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8PLSBFirst,
+ DrawTETextScanlineWidth9PLSBFirst,
+# endif
+# endif
+#else
+ DrawTETextScanlineWidth6, DrawTETextScanlineWidth7,
+ DrawTETextScanlineWidth8, DrawTETextScanlineWidth9,
+#endif
+ DrawTETextScanlineWidth10,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth12,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth14,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth16,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth18,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineWidth24,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric,
+ DrawTETextScanlineGeneric, DrawTETextScanlineGeneric
+};
+
+GlyphScanlineFuncPtr *glyph_get_scanline_func(void) {
+ return glyph_scanline_func;
+}
+
+
+/********************************************************************
+
+ Here we have TEGlyphRenders for a bunch of different color
+ expansion types. The driver may provide its own renderer, but
+ this is the default one which renders using lower-level primitives
+ exported by the chipset driver.
+
+********************************************************************/
+
+/* This gets built for MSBFIRST or LSBFIRST with FIXEDBASE or not.
+ A total of 4 versions */
+
+void
+EXPNAME(XAATEGlyphRenderer)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32* base;
+ GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
+ int dwords = 0;
+
+ if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft &&
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+
+ if(width > w) width = w;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+ while(count--) {
+ register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
+ WRITE_BITS(tmp);
+ }
+
+ w -= width;
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((((width + 31) >> 5) * h) & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+ dwords = ((w + 31) >> 5) * h;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+#ifndef FIXEDBASE
+ if((((w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ while(h--) {
+ base = (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
+ }
+ else
+#endif
+ while(h--) {
+ (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
+ }
+
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+THE_END:
+
+ if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+/********************************************************************
+
+ This is the GlyphRenderer for TRIPLE_BITS_24BPP. It renders to a buffer
+ with the non FIXEDBASE LSB_FIRST code before tripling, and possibly
+ reversing the bits and sending them to the screen
+
+********************************************************************/
+
+void
+EXPNAME(XAATEGlyphRenderer3)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ CARD32 *base, *mem;
+ GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
+ int dwords = 0;
+
+ if((bg != -1) &&
+ ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+ CARD32 bits;
+
+ if(width > w) width = w;
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+ while(count--) {
+ bits = SHIFT_R(glyphs[0][line++],skipleft);
+ if (width >= 22) {
+ WRITE_BITS3(bits);
+ } else if (width >= 11) {
+ WRITE_BITS2(bits);
+ } else {
+ WRITE_BITS1(bits);
+ }
+ }
+
+ w -= width;
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ ((((3 * width + 31) >> 5) * h) & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ dwords = ((3 * w + 31) >> 5) * h;
+ mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char));
+ if (!mem) return;
+
+ (*infoRec->SubsequentCPUToScreenColorExpandFill)(pScrn, x, y, w, h, 0);
+
+ base = (CARD32*)infoRec->ColorExpandBase;
+
+# ifndef FIXEDBASE
+ if((((3 * w + 31) >> 5) * h) <= infoRec->ColorExpandRange)
+ while(h--) {
+ (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
+ base = DrawTextScanline3(base, mem, w);
+ }
+ else
+# endif
+ while(h--) {
+ (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
+ DrawTextScanline3(base, mem, w);
+ }
+
+ free(mem);
+
+ if((infoRec->TEGlyphRendererFlags & CPU_TRANSFER_PAD_QWORD) &&
+ (dwords & 1)) {
+ base = (CARD32*)infoRec->ColorExpandBase;
+ base[0] = 0x00000000;
+ }
+
+THE_END:
+
+ if(infoRec->TEGlyphRendererFlags & SYNC_AFTER_COLOR_EXPAND)
+ (*infoRec->Sync)(pScrn);
+ else SET_SYNC_FLAG(infoRec);
+}
+
+
+#ifndef FIXEDBASE
+/* Scanline version of above gets built for LSBFIRST and MSBFIRST */
+
+void
+EXPNAME(XAATEGlyphRendererScanline)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo;
+ CARD32* base;
+ GlyphScanlineFuncPtr GlyphFunc = glyph_scanline_func[glyphWidth - 1];
+
+ if((bg != -1) && (infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY)) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft &&
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING) ||
+ (!(infoRec->TEGlyphRendererFlags & LEFT_EDGE_CLIPPING_NEGATIVE_X) &&
+ (skipleft > x)))) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+
+ if(width > w) width = w;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ bufferNo = 0;
+
+ while(count--) {
+ register CARD32 tmp = SHIFT_R(glyphs[0][line++],skipleft);
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ WRITE_BITS(tmp);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ w -= width;
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ bufferNo = 0;
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*GlyphFunc)(base, glyphs, startline++, w, glyphWidth);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+THE_END:
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+void
+EXPNAME(XAATEGlyphRendererScanline3)(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+)
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int bufferNo;
+ CARD32 *base, *mem;
+ GlyphScanlineFuncPtr GlyphFunc = XAAGlyphScanlineFuncLSBFirst[glyphWidth - 1];
+
+ if((bg != -1) &&
+ ((infoRec->TEGlyphRendererFlags & TRANSPARENCY_ONLY) ||
+ ((infoRec->TEGlyphRendererFlags & RGB_EQUAL) &&
+ (!CHECK_RGB_EQUAL(bg))))) {
+ (*infoRec->SetupForSolidFill)(pScrn, bg, rop, planemask);
+ (*infoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h);
+ bg = -1;
+ }
+
+ (*infoRec->SetupForScanlineCPUToScreenColorExpandFill)(
+ pScrn, fg, bg, rop, planemask);
+
+ if(skipleft) {
+ /* draw the first character only */
+
+ int count = h, line = startline;
+ int width = glyphWidth - skipleft;
+ CARD32 bits;
+
+ if(width > w) width = w;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, width, h, 0);
+
+ bufferNo = 0;
+
+ while(count--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ bits = SHIFT_R(glyphs[0][line++],skipleft);
+ if (width >= 22) {
+ WRITE_BITS3(bits);
+ } else if (width >= 11) {
+ WRITE_BITS2(bits);
+ } else {
+ WRITE_BITS1(bits);
+ }
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ w -= width;
+ if(!w) goto THE_END;
+ glyphs++;
+ x += width;
+ skipleft = 0; /* nicely aligned again */
+ }
+
+ w += skipleft;
+ x -= skipleft;
+ mem = (CARD32*)malloc(((w + 31) >> 3) * sizeof(char));
+ if (!mem) return;
+
+ (*infoRec->SubsequentScanlineCPUToScreenColorExpandFill)(
+ pScrn, x, y, w, h, skipleft);
+
+ bufferNo = 0;
+
+ while(h--) {
+ base = (CARD32*)infoRec->ScanlineColorExpandBuffers[bufferNo];
+ (*GlyphFunc)(mem, glyphs, startline++, w, glyphWidth);
+ DrawTextScanline3(base, mem, w);
+ (*infoRec->SubsequentColorExpandScanline)(pScrn, bufferNo++);
+ if(bufferNo >= infoRec->NumScanlineColorExpandBuffers)
+ bufferNo = 0;
+ }
+
+ free(mem);
+
+THE_END:
+
+ SET_SYNC_FLAG(infoRec);
+}
+
+#endif
+
+
+
+/********************************************************************
+
+ TRIPLE_BITS_24BPP scanline rendering code.
+
+********************************************************************/
+
+
+
+static CARD32*
+DrawTextScanline3(
+ CARD32 *base,
+ CARD32 *mem,
+ int width )
+{
+
+ while(width > 32) {
+ WRITE_BITS3(*mem);
+ mem++;
+ width -= 32;
+ }
+ if(width) {
+ if (width >= 22) {
+ WRITE_BITS3(*mem);
+ } else if (width >= 11) {
+ WRITE_BITS2(*mem);
+ } else {
+ WRITE_BITS1(*mem);
+ }
+ }
+
+ return base;
+}
+
+
+/********************************************************************
+
+ Generic TE scanline rendering code.
+
+********************************************************************/
+
+
+
+static CARD32*
+DrawTETextScanlineGeneric(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ CARD32 bits = (*glyphp)[line];
+ int shift = glyphwidth;
+
+ while(width > 32) {
+ while(shift < 32) {
+ glyphp++;
+ bits |= SHIFT_L((*glyphp)[line], shift);
+ shift += glyphwidth;
+ }
+ WRITE_BITS(bits);
+ shift &= 31;
+ if(shift)
+ bits = SHIFT_R((*glyphp)[line],(glyphwidth - shift));
+ else bits = 0;
+ width -= 32;
+ }
+
+ if(width) {
+ width -= shift;
+ while(width > 0) {
+ glyphp++;
+ bits |= SHIFT_L((*glyphp)[line],shift);
+ shift += glyphwidth;
+ width -= glyphwidth;
+ }
+ WRITE_BITS(bits);
+ }
+
+ return base;
+}
+
+
+/********************************************************************
+
+ Loop unrolled TE font scanline rendering code
+
+********************************************************************/
+
+
+#ifndef USEASSEMBLER
+static CARD32*
+DrawTETextScanlineWidth6(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],6);
+ bits |= SHIFT_L(glyphp[2][line],12);
+ bits |= SHIFT_L(glyphp[3][line],18);
+ bits |= SHIFT_L(glyphp[4][line],24);
+ bits |= SHIFT_L(glyphp[5][line],30);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[5][line],2);
+ bits |= SHIFT_L(glyphp[6][line],4);
+ bits |= SHIFT_L(glyphp[7][line],10);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],22);
+ bits |= SHIFT_L(glyphp[10][line],28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[10][line],4);
+ bits |= SHIFT_L(glyphp[11][line],2);
+ bits |= SHIFT_L(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],14);
+ bits |= SHIFT_L(glyphp[14][line],20);
+ bits |= SHIFT_L(glyphp[15][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 16;
+ }
+ return base;
+}
+#endif
+
+static CARD32*
+DrawTETextScanlineWidth7(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],7);
+ bits |= SHIFT_L(glyphp[2][line],14);
+ bits |= SHIFT_L(glyphp[3][line],21);
+ bits |= SHIFT_L(glyphp[4][line],28);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[4][line],4);
+ bits |= SHIFT_L(glyphp[5][line],3);
+ bits |= SHIFT_L(glyphp[6][line],10);
+ bits |= SHIFT_L(glyphp[7][line],17);
+ bits |= SHIFT_L(glyphp[8][line],24);
+ bits |= SHIFT_L(glyphp[9][line],31);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[9][line],1);
+ bits |= SHIFT_L(glyphp[10][line],6);
+ bits |= SHIFT_L(glyphp[11][line],13);
+ bits |= SHIFT_L(glyphp[12][line],20);
+ bits |= SHIFT_L(glyphp[13][line],27);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[13][line],5);
+ bits |= SHIFT_L(glyphp[14][line],2);
+ bits |= SHIFT_L(glyphp[15][line],9);
+ bits |= SHIFT_L(glyphp[16][line],16);
+ bits |= SHIFT_L(glyphp[17][line],23);
+ bits |= SHIFT_L(glyphp[18][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[18][line],2);
+ bits |= SHIFT_L(glyphp[19][line],5);
+ bits |= SHIFT_L(glyphp[20][line],12);
+ bits |= SHIFT_L(glyphp[21][line],19);
+ bits |= SHIFT_L(glyphp[22][line],26);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[22][line],6);
+ bits |= SHIFT_L(glyphp[23][line],1);
+ bits |= SHIFT_L(glyphp[24][line],8);
+ bits |= SHIFT_L(glyphp[25][line],15);
+ bits |= SHIFT_L(glyphp[26][line],22);
+ bits |= SHIFT_L(glyphp[27][line],29);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[27][line],3);
+ bits |= SHIFT_L(glyphp[28][line],4);
+ bits |= SHIFT_L(glyphp[29][line],11);
+ bits |= SHIFT_L(glyphp[30][line],18);
+ bits |= SHIFT_L(glyphp[31][line],25);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+#ifndef FIXEDBASE
+ base += 7;
+#endif
+ width -= 224;
+ glyphp += 32;
+ }
+ return base;
+}
+
+
+#ifndef USEASSEMBLER
+static CARD32*
+DrawTETextScanlineWidth8(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],8);
+ bits |= SHIFT_L(glyphp[2][line],16);
+ bits |= SHIFT_L(glyphp[3][line],24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = glyphp[4][line];
+ bits |= SHIFT_L(glyphp[5][line],8);
+ bits |= SHIFT_L(glyphp[6][line],16);
+ bits |= SHIFT_L(glyphp[7][line],24);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+#ifndef FIXEDBASE
+ base += 2;
+#endif
+ width -= 64;
+ glyphp += 8;
+ }
+ return base;
+}
+#endif
+
+#ifndef USEASSEMBLER
+static CARD32*
+DrawTETextScanlineWidth9(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],9);
+ bits |= SHIFT_L(glyphp[2][line],18);
+ bits |= SHIFT_L(glyphp[3][line],27);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[3][line],5);
+ bits |= SHIFT_L(glyphp[4][line],4);
+ bits |= SHIFT_L(glyphp[5][line],13);
+ bits |= SHIFT_L(glyphp[6][line],22);
+ bits |= SHIFT_L(glyphp[7][line],31);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[7][line],1);
+ bits |= SHIFT_L(glyphp[8][line],8);
+ bits |= SHIFT_L(glyphp[9][line],17);
+ bits |= SHIFT_L(glyphp[10][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[10][line],6);
+ bits |= SHIFT_L(glyphp[11][line],3);
+ bits |= SHIFT_L(glyphp[12][line],12);
+ bits |= SHIFT_L(glyphp[13][line],21);
+ bits |= SHIFT_L(glyphp[14][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[14][line],2);
+ bits |= SHIFT_L(glyphp[15][line],7);
+ bits |= SHIFT_L(glyphp[16][line],16);
+ bits |= SHIFT_L(glyphp[17][line],25);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[17][line],7);
+ bits |= SHIFT_L(glyphp[18][line],2);
+ bits |= SHIFT_L(glyphp[19][line],11);
+ bits |= SHIFT_L(glyphp[20][line],20);
+ bits |= SHIFT_L(glyphp[21][line],29);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[21][line],3);
+ bits |= SHIFT_L(glyphp[22][line],6);
+ bits |= SHIFT_L(glyphp[23][line],15);
+ bits |= SHIFT_L(glyphp[24][line],24);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+ bits = SHIFT_R(glyphp[24][line],8);
+ bits |= SHIFT_L(glyphp[25][line],1);
+ bits |= SHIFT_L(glyphp[26][line],10);
+ bits |= SHIFT_L(glyphp[27][line],19);
+ bits |= SHIFT_L(glyphp[28][line],28);
+ WRITE_IN_BITORDER(base, 7, bits);
+ CHECKRETURN(8);
+ bits = SHIFT_R(glyphp[28][line],4);
+ bits |= SHIFT_L(glyphp[29][line],5);
+ bits |= SHIFT_L(glyphp[30][line],14);
+ bits |= SHIFT_L(glyphp[31][line],23);
+ WRITE_IN_BITORDER(base, 8, bits);
+ CHECKRETURN(9);
+#ifndef FIXEDBASE
+ base += 9;
+#endif
+ width -= 288;
+ glyphp += 32;
+ }
+ return base;
+}
+#endif
+
+static CARD32*
+DrawTETextScanlineWidth10(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],10);
+ bits |= SHIFT_L(glyphp[2][line],20);
+ bits |= SHIFT_L(glyphp[3][line],30);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[3][line],2);
+ bits |= SHIFT_L(glyphp[4][line],8);
+ bits |= SHIFT_L(glyphp[5][line],18);
+ bits |= SHIFT_L(glyphp[6][line],28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[6][line],4);
+ bits |= SHIFT_L(glyphp[7][line],6);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[9][line],6);
+ bits |= SHIFT_L(glyphp[10][line],4);
+ bits |= SHIFT_L(glyphp[11][line],14);
+ bits |= SHIFT_L(glyphp[12][line],24);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],2);
+ bits |= SHIFT_L(glyphp[14][line],12);
+ bits |= SHIFT_L(glyphp[15][line],22);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+#ifndef FIXEDBASE
+ base += 5;
+#endif
+ width -= 160;
+ glyphp += 16;
+ }
+ return base;
+}
+
+static CARD32*
+DrawTETextScanlineWidth12(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],12);
+ bits |= SHIFT_L(glyphp[2][line],24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[2][line],8);
+ bits |= SHIFT_L(glyphp[3][line],4);
+ bits |= SHIFT_L(glyphp[4][line],16);
+ bits |= SHIFT_L(glyphp[5][line],28);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[5][line],4);
+ bits |= SHIFT_L(glyphp[6][line],8);
+ bits |= SHIFT_L(glyphp[7][line],20);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 8;
+ }
+ return base;
+}
+
+
+
+static CARD32*
+DrawTETextScanlineWidth14(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],14);
+ bits |= SHIFT_L(glyphp[2][line],28);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[2][line],4);
+ bits |= SHIFT_L(glyphp[3][line],10);
+ bits |= SHIFT_L(glyphp[4][line],24);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[4][line],8);
+ bits |= SHIFT_L(glyphp[5][line],6);
+ bits |= SHIFT_L(glyphp[6][line],20);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[6][line],12);
+ bits |= SHIFT_L(glyphp[7][line],2);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[9][line],2);
+ bits |= SHIFT_L(glyphp[10][line],12);
+ bits |= SHIFT_L(glyphp[11][line],26);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[11][line],6);
+ bits |= SHIFT_L(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],22);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[13][line],10);
+ bits |= SHIFT_L(glyphp[14][line],4);
+ bits |= SHIFT_L(glyphp[15][line],18);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+#ifndef FIXEDBASE
+ base += 7;
+#endif
+ width -= 224;
+ glyphp += 16;
+ }
+ return base;
+}
+
+
+static CARD32*
+DrawTETextScanlineWidth16(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],16);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = glyphp[2][line];
+ bits |= SHIFT_L(glyphp[3][line],16);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = glyphp[4][line];
+ bits |= SHIFT_L(glyphp[5][line],16);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = glyphp[6][line];
+ bits |= SHIFT_L(glyphp[7][line],16);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+#ifndef FIXEDBASE
+ base += 4;
+#endif
+ width -= 128;
+ glyphp += 8;
+ }
+ return base;
+}
+
+
+
+static CARD32*
+DrawTETextScanlineWidth18(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],18);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[1][line],14);
+ bits |= SHIFT_L(glyphp[2][line],4);
+ bits |= SHIFT_L(glyphp[3][line],22);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[3][line],10);
+ bits |= SHIFT_L(glyphp[4][line],8);
+ bits |= SHIFT_L(glyphp[5][line],26);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+ bits = SHIFT_R(glyphp[5][line],6);
+ bits |= SHIFT_L(glyphp[6][line],12);
+ bits |= SHIFT_L(glyphp[7][line],30);
+ WRITE_IN_BITORDER(base, 3, bits);
+ CHECKRETURN(4);
+ bits = SHIFT_R(glyphp[7][line],2);
+ bits |= SHIFT_L(glyphp[8][line],16);
+ WRITE_IN_BITORDER(base, 4, bits);
+ CHECKRETURN(5);
+ bits = SHIFT_R(glyphp[8][line],16);
+ bits |= SHIFT_L(glyphp[9][line],2);
+ bits |= SHIFT_L(glyphp[10][line],20);
+ WRITE_IN_BITORDER(base, 5, bits);
+ CHECKRETURN(6);
+ bits = SHIFT_R(glyphp[10][line],12);
+ bits |= SHIFT_L(glyphp[11][line],6);
+ bits |= SHIFT_L(glyphp[12][line],24);
+ WRITE_IN_BITORDER(base, 6, bits);
+ CHECKRETURN(7);
+ bits = SHIFT_R(glyphp[12][line],8);
+ bits |= SHIFT_L(glyphp[13][line],10);
+ bits |= SHIFT_L(glyphp[14][line],28);
+ WRITE_IN_BITORDER(base, 7, bits);
+ CHECKRETURN(8);
+ bits = SHIFT_R(glyphp[14][line],4);
+ bits |= SHIFT_L(glyphp[15][line],14);
+ WRITE_IN_BITORDER(base, 8, bits);
+ CHECKRETURN(9);
+#ifndef FIXEDBASE
+ base += 9;
+#endif
+ width -= 288;
+ glyphp += 16;
+ }
+ return base;
+}
+
+
+static CARD32*
+DrawTETextScanlineWidth24(
+ CARD32 *base,
+ unsigned int **glyphp,
+ int line, int width, int glyphwidth )
+{
+ while (1) {
+ unsigned int bits;
+ bits = glyphp[0][line];
+ bits |= SHIFT_L(glyphp[1][line],24);
+ WRITE_IN_BITORDER(base, 0, bits);
+ CHECKRETURN(1);
+ bits = SHIFT_R(glyphp[1][line],8);
+ bits |= SHIFT_L(glyphp[2][line],16);
+ WRITE_IN_BITORDER(base, 1, bits);
+ CHECKRETURN(2);
+ bits = SHIFT_R(glyphp[2][line],16);
+ bits |= SHIFT_L(glyphp[3][line],8);
+ WRITE_IN_BITORDER(base, 2, bits);
+ CHECKRETURN(3);
+#ifndef FIXEDBASE
+ base += 3;
+#endif
+ width -= 96;
+ glyphp += 4;
+ }
+ return base;
+}
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaTEText.c b/xorg-server/hw/xfree86/xaa/xaaTEText.c
index fc445726f..1e28d3103 100644
--- a/xorg-server/hw/xfree86/xaa/xaaTEText.c
+++ b/xorg-server/hw/xfree86/xaa/xaaTEText.c
@@ -1,312 +1,312 @@
-
-/********************************************************************
-
- In this file we have GC level replacements for PolyText8/16,
- ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts.
- The idea is that everything in this file is device independent.
- The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion
- which calculates the boxes containing arbitrarily clipped text
- and passes them to the TEGlyphRenderer which will usually be a lower
- level XAA function which renders these clipped glyphs using
- the basic color expansion functions exported by the chipset driver.
- The TEGlyphRenderer itself may optionally be driver supplied to
- facilitate work-arounds/optimizations at a higher level than usual.
-
- v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu)
-
-
-********************************************************************/
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-
-#include <X11/X.h>
-#include <X11/fonts/font.h>
-#include "scrnintstr.h"
-#include "dixfontstr.h"
-#include "xf86str.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "gcstruct.h"
-#include "pixmapstr.h"
-
-
-static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
- int yInit, FontPtr font, int fg, int bg, int rop,
- unsigned int planemask, RegionPtr cclip, int nglyph,
- unsigned char* gBase, CharInfoPtr *ppci);
-
-
-/********************************************************************
-
- GC level replacements for PolyText8/16 and ImageText8/16
- for TE fonts when using color expansion.
-
-********************************************************************/
-
-
-int
-XAAPolyText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-
- return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
-}
-
-
-int
-XAAPolyText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-
- return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
-}
-
-
-void
-XAAImageText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
- (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
-
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-void
-XAAImageText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
- unsigned long n;
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- (*pGC->font->get_glyphs)(
- pGC->font, (unsigned long)count, (unsigned char *)chars,
- (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
- &n, infoRec->CharInfo);
-
- if(n) XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, x + pDraw->x, y + pDraw->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
- pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
-}
-
-
-
-/********************************************************************
-
- GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
- TE fonts when using color expansion.
-
-********************************************************************/
-
-
-void
-XAAImageGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
- pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-void
-XAAPolyGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
-
- if(!REGION_NUM_RECTS(pGC->pCompositeClip))
- return;
-
- XAAGlyphBltTEColorExpansion(
- infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
- pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
- pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
-}
-
-
-
-
-/********************************************************************
-
- XAAGlyphBltTEColorExpansion -
-
- This guy computes the clipped pieces of text and sends it to
- the lower-level function which will handle acceleration of
- arbitrarily clipped text.
-
-********************************************************************/
-
-
-static void
-XAAGlyphBltTEColorExpansion(
- ScrnInfoPtr pScrn,
- int xInit, int yInit,
- FontPtr font,
- int fg, int bg,
- int rop,
- unsigned int planemask,
- RegionPtr cclip,
- int nglyph,
- unsigned char* gBase,
- CharInfoPtr *ppci )
-{
- XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
- int skippix, skipglyphs;
- int Left, Right, Top, Bottom;
- int LeftEdge, RightEdge, ytop, ybot;
- int nbox = REGION_NUM_RECTS(cclip);
- BoxPtr pbox = REGION_RECTS(cclip);
- unsigned int **glyphs = NULL;
- int glyphWidth = FONTMAXBOUNDS(font, characterWidth);
-
- /* find the size of the box */
- Left = xInit;
- Right = Left + (glyphWidth * nglyph);
- Top = yInit - FONTASCENT(font);
- Bottom = yInit + FONTDESCENT(font);
-
- /* get into the first band that may contain part of our string */
- while(nbox && (Top >= pbox->y2)) {
- pbox++; nbox--;
- }
-
- /* stop when the lower edge of the box is beyond our string */
- while(nbox && (Bottom > pbox->y1)) {
- LeftEdge = max(Left, pbox->x1);
- RightEdge = min(Right, pbox->x2);
-
- if(RightEdge > LeftEdge) { /* we have something to draw */
- unsigned int *fallbackBits = NULL;
- ytop = max(Top, pbox->y1);
- ybot = min(Bottom, pbox->y2);
-
- if((skippix = LeftEdge - Left)) {
- skipglyphs = skippix/glyphWidth;
- skippix %= glyphWidth;
- } else skipglyphs = 0;
-
- if(!glyphs) {
- int count;
- glyphs = (unsigned int**)(infoRec->PreAllocMem);
-
- for(count = 0; count < nglyph; count++) {
- glyphs[count] = (unsigned int*)
- FONTGLYPHBITS(gBase,*ppci++);
- if (!glyphs[count]) {
- /* Glyphs with NULL bits do exist in the wild.
- Replace with blank bits in that case */
-
- if (!fallbackBits) {
- int fontHeight = Bottom - Top + 1;
- fallbackBits = xcalloc (glyphWidth * fontHeight, 1);
- if (!fallbackBits)
- return;
- }
- glyphs[count] = fallbackBits;
- }
- }
-
- /* our new unrolled TE code only writes DWORDS at a time
- so it can read up to 6 characters past the last one
- we're displaying */
- glyphs[count + 0] = glyphs[0];
- glyphs[count + 1] = glyphs[0];
- glyphs[count + 2] = glyphs[0];
- glyphs[count + 3] = glyphs[0];
- glyphs[count + 4] = glyphs[0];
- glyphs[count + 5] = glyphs[0];
- }
-
- /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */
-
- (*infoRec->TEGlyphRenderer)( pScrn,
- LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop,
- skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
- fg, bg, rop, planemask);
-
- if (fallbackBits)
- xfree (fallbackBits);
- }
-
- nbox--; pbox++;
- }
-}
-
-
-
-
+
+/********************************************************************
+
+ In this file we have GC level replacements for PolyText8/16,
+ ImageText8/16, ImageGlyphBlt and PolyGlyphBlt for TE (fixed) fonts.
+ The idea is that everything in this file is device independent.
+ The mentioned GCOps are merely wrappers for XAAGlyphBltTEColorExpansion
+ which calculates the boxes containing arbitrarily clipped text
+ and passes them to the TEGlyphRenderer which will usually be a lower
+ level XAA function which renders these clipped glyphs using
+ the basic color expansion functions exported by the chipset driver.
+ The TEGlyphRenderer itself may optionally be driver supplied to
+ facilitate work-arounds/optimizations at a higher level than usual.
+
+ v1.0 - Mark Vojkovich (mvojkovi@ucsd.edu)
+
+
+********************************************************************/
+
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include "misc.h"
+#include "xf86.h"
+#include "xf86_OSproc.h"
+
+#include <X11/X.h>
+#include <X11/fonts/font.h>
+#include "scrnintstr.h"
+#include "dixfontstr.h"
+#include "xf86str.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "gcstruct.h"
+#include "pixmapstr.h"
+
+
+static void XAAGlyphBltTEColorExpansion(ScrnInfoPtr pScrn, int xInit,
+ int yInit, FontPtr font, int fg, int bg, int rop,
+ unsigned int planemask, RegionPtr cclip, int nglyph,
+ unsigned char* gBase, CharInfoPtr *ppci);
+
+
+/********************************************************************
+
+ GC level replacements for PolyText8/16 and ImageText8/16
+ for TE fonts when using color expansion.
+
+********************************************************************/
+
+
+int
+XAAPolyText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ /* we have divorced XAAGlyphBltTEColorExpansion from the drawable */
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+
+ return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
+}
+
+
+int
+XAAPolyText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+
+ return (x + (n * FONTMAXBOUNDS(pGC->font, characterWidth)));
+}
+
+
+void
+XAAImageText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(pGC->font, (unsigned long)count,
+ (unsigned char *)chars, Linear8Bit, &n, infoRec->CharInfo);
+
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+void
+XAAImageText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+ unsigned long n;
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ (*pGC->font->get_glyphs)(
+ pGC->font, (unsigned long)count, (unsigned char *)chars,
+ (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit,
+ &n, infoRec->CharInfo);
+
+ if(n) XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, x + pDraw->x, y + pDraw->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, n, FONTGLYPHS(pGC->font), infoRec->CharInfo);
+}
+
+
+
+/********************************************************************
+
+ GC level replacements for ImageGlyphBlt and PolyGlyphBlt for
+ TE fonts when using color expansion.
+
+********************************************************************/
+
+
+void
+XAAImageGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
+ pGC->font, pGC->fgPixel, pGC->bgPixel, GXcopy, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+void
+XAAPolyGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC);
+
+ if(!REGION_NUM_RECTS(pGC->pCompositeClip))
+ return;
+
+ XAAGlyphBltTEColorExpansion(
+ infoRec->pScrn, xInit + pDrawable->x, yInit + pDrawable->y,
+ pGC->font, pGC->fgPixel, -1, pGC->alu, pGC->planemask,
+ pGC->pCompositeClip, nglyph, (unsigned char*)pglyphBase, ppci);
+}
+
+
+
+
+/********************************************************************
+
+ XAAGlyphBltTEColorExpansion -
+
+ This guy computes the clipped pieces of text and sends it to
+ the lower-level function which will handle acceleration of
+ arbitrarily clipped text.
+
+********************************************************************/
+
+
+static void
+XAAGlyphBltTEColorExpansion(
+ ScrnInfoPtr pScrn,
+ int xInit, int yInit,
+ FontPtr font,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask,
+ RegionPtr cclip,
+ int nglyph,
+ unsigned char* gBase,
+ CharInfoPtr *ppci )
+{
+ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn);
+ int skippix, skipglyphs;
+ int Left, Right, Top, Bottom;
+ int LeftEdge, RightEdge, ytop, ybot;
+ int nbox = REGION_NUM_RECTS(cclip);
+ BoxPtr pbox = REGION_RECTS(cclip);
+ unsigned int **glyphs = NULL;
+ int glyphWidth = FONTMAXBOUNDS(font, characterWidth);
+
+ /* find the size of the box */
+ Left = xInit;
+ Right = Left + (glyphWidth * nglyph);
+ Top = yInit - FONTASCENT(font);
+ Bottom = yInit + FONTDESCENT(font);
+
+ /* get into the first band that may contain part of our string */
+ while(nbox && (Top >= pbox->y2)) {
+ pbox++; nbox--;
+ }
+
+ /* stop when the lower edge of the box is beyond our string */
+ while(nbox && (Bottom > pbox->y1)) {
+ LeftEdge = max(Left, pbox->x1);
+ RightEdge = min(Right, pbox->x2);
+
+ if(RightEdge > LeftEdge) { /* we have something to draw */
+ unsigned int *fallbackBits = NULL;
+ ytop = max(Top, pbox->y1);
+ ybot = min(Bottom, pbox->y2);
+
+ if((skippix = LeftEdge - Left)) {
+ skipglyphs = skippix/glyphWidth;
+ skippix %= glyphWidth;
+ } else skipglyphs = 0;
+
+ if(!glyphs) {
+ int count;
+ glyphs = (unsigned int**)(infoRec->PreAllocMem);
+
+ for(count = 0; count < nglyph; count++) {
+ glyphs[count] = (unsigned int*)
+ FONTGLYPHBITS(gBase,*ppci++);
+ if (!glyphs[count]) {
+ /* Glyphs with NULL bits do exist in the wild.
+ Replace with blank bits in that case */
+
+ if (!fallbackBits) {
+ int fontHeight = Bottom - Top + 1;
+ fallbackBits = calloc(glyphWidth * fontHeight, 1);
+ if (!fallbackBits)
+ return;
+ }
+ glyphs[count] = fallbackBits;
+ }
+ }
+
+ /* our new unrolled TE code only writes DWORDS at a time
+ so it can read up to 6 characters past the last one
+ we're displaying */
+ glyphs[count + 0] = glyphs[0];
+ glyphs[count + 1] = glyphs[0];
+ glyphs[count + 2] = glyphs[0];
+ glyphs[count + 3] = glyphs[0];
+ glyphs[count + 4] = glyphs[0];
+ glyphs[count + 5] = glyphs[0];
+ }
+
+ /* x, y, w, h, skipleft, skiptop, glyphp, glyphWidth, fg, bg, rop, pm */
+
+ (*infoRec->TEGlyphRenderer)( pScrn,
+ LeftEdge, ytop, RightEdge - LeftEdge, ybot - ytop,
+ skippix, ytop - Top, glyphs + skipglyphs, glyphWidth,
+ fg, bg, rop, planemask);
+
+ if (fallbackBits)
+ free(fallbackBits);
+ }
+
+ nbox--; pbox++;
+ }
+}
+
+
+
+
diff --git a/xorg-server/hw/xfree86/xaa/xaaWrapper.c b/xorg-server/hw/xfree86/xaa/xaaWrapper.c
index d6409887c..f709d0b35 100644
--- a/xorg-server/hw/xfree86/xaa/xaaWrapper.c
+++ b/xorg-server/hw/xfree86/xaa/xaaWrapper.c
@@ -1,474 +1,474 @@
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "gcstruct.h"
-#include "glyphstr.h"
-#include "window.h"
-#include "windowstr.h"
-#include "picture.h"
-#include "picturestr.h"
-#include "colormapst.h"
-#include "xaa.h"
-#include "xaalocal.h"
-#include "xaaWrapper.h"
-
-void XAASync(ScreenPtr pScreen);
-
-/* #include "render.h" */
-
-#if 1
-#define COND(pDraw) \
- ((pDraw)->depth \
- != (xaaWrapperGetScrPriv(((DrawablePtr)(pDraw))->pScreen))->depth)
-#else
-#define COND(pDraw) 1
-#endif
-
-static Bool xaaWrapperCreateGC(GCPtr pGC);
-static void xaaWrapperValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
-static void xaaWrapperDestroyGC(GCPtr pGC);
-static void xaaWrapperChangeGC (GCPtr pGC, unsigned long mask);
-static void xaaWrapperCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
-static void xaaWrapperChangeClip (GCPtr pGC, int type, pointer pvalue, int nrects);
-
-static void xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
-static void xaaWrapperDestroyClip(GCPtr pGC);
-
-
-static void
-xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
-static void
-xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs);
-
-
-typedef struct {
- CloseScreenProcPtr CloseScreen;
- CreateScreenResourcesProcPtr CreateScreenResources;
- CreateWindowProcPtr CreateWindow;
- CopyWindowProcPtr CopyWindow;
- WindowExposuresProcPtr WindowExposures;
- CreateGCProcPtr CreateGC;
- CreateColormapProcPtr CreateColormap;
- DestroyColormapProcPtr DestroyColormap;
- InstallColormapProcPtr InstallColormap;
- UninstallColormapProcPtr UninstallColormap;
- ListInstalledColormapsProcPtr ListInstalledColormaps;
- StoreColorsProcPtr StoreColors;
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
-
- CloseScreenProcPtr wrapCloseScreen;
- CreateScreenResourcesProcPtr wrapCreateScreenResources;
- CreateWindowProcPtr wrapCreateWindow;
- CopyWindowProcPtr wrapCopyWindow;
- WindowExposuresProcPtr wrapWindowExposures;
- CreateGCProcPtr wrapCreateGC;
- CreateColormapProcPtr wrapCreateColormap;
- DestroyColormapProcPtr wrapDestroyColormap;
- InstallColormapProcPtr wrapInstallColormap;
- UninstallColormapProcPtr wrapUninstallColormap;
- ListInstalledColormapsProcPtr wrapListInstalledColormaps;
- StoreColorsProcPtr wrapStoreColors;
- CompositeProcPtr wrapComposite;
- GlyphsProcPtr wrapGlyphs;
- int depth;
-} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
-
-#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \
- dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey))
-#define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s)
-
-#define wrap(priv,real,mem,func) {\
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define unwrap(priv,real,mem) {\
- real->mem = priv->mem; \
-}
-
-#define cond_wrap(priv,cond,real,mem,wrapmem,func) {\
- if (COND(cond)) \
- priv->wrapmem = real->mem; \
- else \
- priv->mem = real->mem; \
- real->mem = func; \
-}
-
-#define cond_unwrap(priv,cond,real,mem,wrapmem) {\
- if (COND(cond)) \
- real->mem = priv->wrapmem; \
- else \
- real->mem = priv->mem; \
-}
-
-#define get(priv,real,func,wrap) \
- priv->wrap = real->func;
-
-typedef struct _xaaWrapperGCPriv {
- GCOps *ops;
- Bool wrap;
- GCFuncs *funcs;
- GCOps *wrapops;
-} xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr;
-
-#define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \
- dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey))
-#define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC)
-
-
-static int xaaWrapperScrPrivateKeyIndex;
-static DevPrivateKey xaaWrapperScrPrivateKey = &xaaWrapperScrPrivateKeyIndex;
-static int xaaWrapperGCPrivateKeyIndex;
-static DevPrivateKey xaaWrapperGCPrivateKey = &xaaWrapperGCPrivateKeyIndex;
-
-static Bool
-xaaWrapperCreateScreenResources(ScreenPtr pScreen)
-{
- xaaWrapperScrPriv(pScreen);
- Bool ret;
-
- unwrap (pScrPriv,pScreen, CreateScreenResources);
- ret = pScreen->CreateScreenResources(pScreen);
- wrap(pScrPriv,pScreen,CreateScreenResources,xaaWrapperCreateScreenResources);
- return ret;
-}
-
-static Bool
-xaaWrapperCloseScreen (int iScreen, ScreenPtr pScreen)
-{
- xaaWrapperScrPriv(pScreen);
- Bool ret;
-
- unwrap (pScrPriv,pScreen, CloseScreen);
- ret = pScreen->CloseScreen(iScreen,pScreen);
- return TRUE;
-}
-
-static Bool
-xaaWrapperCreateWindow(WindowPtr pWin)
-{
- xaaWrapperScrPriv(pWin->drawable.pScreen);
- Bool ret;
-
- cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
- CreateWindow, wrapCreateWindow);
- ret = pWin->drawable.pScreen->CreateWindow(pWin);
- cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen, CreateWindow,
- wrapCreateWindow, xaaWrapperCreateWindow);
-
- return ret;
-}
-
-static void
-xaaWrapperCopyWindow(WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc)
-{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- xaaWrapperScrPriv(pScreen);
-
- unwrap (pScrPriv, pScreen, CopyWindow);
-#if 0
- if (COND(&pWin->drawable))
- pWin->drawable.pScreen->CopyWindow = pScrPriv->wrapCopyWindow;
-#endif
- pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
- wrap(pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
-}
-
-static void
-xaaWrapperWindowExposures (WindowPtr pWin,
- RegionPtr prgn,
- RegionPtr other_exposed)
-{
- xaaWrapperScrPriv(pWin->drawable.pScreen);
-
- cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
- WindowExposures, wrapWindowExposures);
- pWin->drawable.pScreen->WindowExposures(pWin, prgn, other_exposed);
- cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
- WindowExposures, wrapWindowExposures, xaaWrapperWindowExposures);
-}
-
-static Bool
-xaaWrapperCreateColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
- Bool ret;
- unwrap(pScrPriv,pmap->pScreen, CreateColormap);
- ret = pmap->pScreen->CreateColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,CreateColormap,xaaWrapperCreateColormap);
-
- return ret;
-}
-
-static void
-xaaWrapperDestroyColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
- unwrap(pScrPriv,pmap->pScreen, DestroyColormap);
- pmap->pScreen->DestroyColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,DestroyColormap,xaaWrapperDestroyColormap);
-}
-
-static void
-xaaWrapperStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
-{
- xaaWrapperScrPriv(pmap->pScreen);
- unwrap(pScrPriv,pmap->pScreen, StoreColors);
- pmap->pScreen->StoreColors(pmap,nColors,pColors);
- wrap(pScrPriv,pmap->pScreen,StoreColors,xaaWrapperStoreColors);
-}
-
-static void
-xaaWrapperInstallColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
-
- unwrap(pScrPriv,pmap->pScreen, InstallColormap);
- pmap->pScreen->InstallColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,InstallColormap,xaaWrapperInstallColormap);
-}
-
-static void
-xaaWrapperUninstallColormap(ColormapPtr pmap)
-{
- xaaWrapperScrPriv(pmap->pScreen);
-
- unwrap(pScrPriv,pmap->pScreen, UninstallColormap);
- pmap->pScreen->UninstallColormap(pmap);
- wrap(pScrPriv,pmap->pScreen,UninstallColormap,xaaWrapperUninstallColormap);
-}
-
-static int
-xaaWrapperListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
-{
- int n;
- xaaWrapperScrPriv(pScreen);
-
- unwrap(pScrPriv,pScreen, ListInstalledColormaps);
- n = pScreen->ListInstalledColormaps(pScreen, pCmapIds);
- wrap (pScrPriv,pScreen,ListInstalledColormaps,xaaWrapperListInstalledColormaps);
- return n;
-}
-
-Bool
-xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *func)
-{
- Bool ret;
- xaaWrapperScrPrivPtr pScrPriv;
- PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
-
- if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
- return FALSE;
-
- pScrPriv = (xaaWrapperScrPrivPtr) xalloc (sizeof (xaaWrapperScrPrivRec));
- if (!pScrPriv)
- return FALSE;
-
- get (pScrPriv, pScreen, CloseScreen, wrapCloseScreen);
- get (pScrPriv, pScreen, CreateScreenResources, wrapCreateScreenResources);
- get (pScrPriv, pScreen, CreateWindow, wrapCreateWindow);
- get (pScrPriv, pScreen, CopyWindow, wrapCopyWindow);
- get (pScrPriv, pScreen, WindowExposures, wrapWindowExposures);
- get (pScrPriv, pScreen, CreateGC, wrapCreateGC);
- get (pScrPriv, pScreen, CreateColormap, wrapCreateColormap);
- get (pScrPriv, pScreen, DestroyColormap, wrapDestroyColormap);
- get (pScrPriv, pScreen, InstallColormap, wrapInstallColormap);
- get (pScrPriv, pScreen, UninstallColormap, wrapUninstallColormap);
- get (pScrPriv, pScreen, ListInstalledColormaps, wrapListInstalledColormaps);
- get (pScrPriv, pScreen, StoreColors, wrapStoreColors);
- if (ps) {
- get (pScrPriv, ps, Glyphs, wrapGlyphs);
- get (pScrPriv, ps, Composite, wrapComposite);
- }
- if (!(ret = XAAInit(pScreen,infoPtr)))
- return FALSE;
-
- wrap (pScrPriv, pScreen, CloseScreen, xaaWrapperCloseScreen);
- wrap (pScrPriv, pScreen, CreateScreenResources,
- xaaWrapperCreateScreenResources);
- wrap (pScrPriv, pScreen, CreateWindow, xaaWrapperCreateWindow);
- wrap (pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
- wrap (pScrPriv, pScreen, WindowExposures, xaaWrapperWindowExposures);
- wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
- wrap (pScrPriv, pScreen, CreateColormap, xaaWrapperCreateColormap);
- wrap (pScrPriv, pScreen, DestroyColormap, xaaWrapperDestroyColormap);
- wrap (pScrPriv, pScreen, InstallColormap, xaaWrapperInstallColormap);
- wrap (pScrPriv, pScreen, UninstallColormap, xaaWrapperUninstallColormap);
- wrap (pScrPriv, pScreen, ListInstalledColormaps,
- xaaWrapperListInstalledColormaps);
- wrap (pScrPriv, pScreen, StoreColors, xaaWrapperStoreColors);
-
- if (ps) {
- wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
- wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
- }
- pScrPriv->depth = depth;
- dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
-
- *func = XAASync;
-
- return ret;
-}
-
-GCFuncs xaaWrapperGCFuncs = {
- xaaWrapperValidateGC, xaaWrapperChangeGC, xaaWrapperCopyGC,
- xaaWrapperDestroyGC, xaaWrapperChangeClip, xaaWrapperDestroyClip,
- xaaWrapperCopyClip
-};
-
-#define XAAWRAPPER_GC_FUNC_PROLOGUE(pGC) \
- xaaWrapperGCPriv(pGC); \
- unwrap(pGCPriv, pGC, funcs); \
- if (pGCPriv->wrap) unwrap(pGCPriv, pGC, ops)
-
-#define XAAWRAPPER_GC_FUNC_EPILOGUE(pGC) \
- wrap(pGCPriv, pGC, funcs, &xaaWrapperGCFuncs); \
- if (pGCPriv->wrap) wrap(pGCPriv, pGC, ops, pGCPriv->wrapops)
-
-static Bool
-xaaWrapperCreateGC(GCPtr pGC)
-{
- ScreenPtr pScreen = pGC->pScreen;
- xaaWrapperScrPriv(pScreen);
- xaaWrapperGCPriv(pGC);
- Bool ret;
-
- unwrap (pScrPriv, pScreen, CreateGC);
- if((ret = (*pScreen->CreateGC) (pGC))) {
- pGCPriv->wrap = FALSE;
- pGCPriv->funcs = pGC->funcs;
- pGCPriv->wrapops = pGC->ops;
- pGC->funcs = &xaaWrapperGCFuncs;
- }
- wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
-
- return ret;
-}
-
-static void
-xaaWrapperValidateGC(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
-
- if(COND(pDraw))
- pGCPriv->wrap = TRUE;
-
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperDestroyGC(GCPtr pGC)
-{
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->DestroyGC)(pGC);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperChangeGC (
- GCPtr pGC,
- unsigned long mask
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeGC) (pGC, mask);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperCopyGC (
- GCPtr pGCSrc,
- unsigned long mask,
- GCPtr pGCDst
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGCDst);
- (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGCDst);
-}
-
-static void
-xaaWrapperChangeClip (
- GCPtr pGC,
- int type,
- pointer pvalue,
- int nrects
-){
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
-{
- XAAWRAPPER_GC_FUNC_PROLOGUE (pgcDst);
- (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pgcDst);
-}
-
-static void
-xaaWrapperDestroyClip(GCPtr pGC)
-{
- XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
- (* pGC->funcs->DestroyClip)(pGC);
- XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
-}
-
-static void
-xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
- INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
- INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- xaaWrapperScrPriv(pScreen);
-
- unwrap (pScrPriv, ps, Composite);
- (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
- xDst, yDst, width, height);
- wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
-}
-
-
-static void
-xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
- PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
- GlyphListPtr list, GlyphPtr *glyphs)
-{
- ScreenPtr pScreen = pDst->pDrawable->pScreen;
- PictureScreenPtr ps = GetPictureScreen(pScreen);
- xaaWrapperScrPriv(pScreen);
-
- unwrap (pScrPriv, ps, Glyphs);
- (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc,
- nlist, list, glyphs);
- wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
-
-}
-
-void
-XAASync(ScreenPtr pScreen)
-{
- XAAScreenPtr pScreenPriv = (XAAScreenPtr)
- dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey());
- XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
-
- if(infoRec->NeedToSync) {
- (*infoRec->Sync)(infoRec->pScrn);
- infoRec->NeedToSync = FALSE;
- }
-}
+#ifdef HAVE_XORG_CONFIG_H
+#include <xorg-config.h>
+#endif
+
+#include <X11/X.h>
+#include <X11/Xproto.h>
+#include "scrnintstr.h"
+#include "gcstruct.h"
+#include "glyphstr.h"
+#include "window.h"
+#include "windowstr.h"
+#include "picture.h"
+#include "picturestr.h"
+#include "colormapst.h"
+#include "xaa.h"
+#include "xaalocal.h"
+#include "xaaWrapper.h"
+
+void XAASync(ScreenPtr pScreen);
+
+/* #include "render.h" */
+
+#if 1
+#define COND(pDraw) \
+ ((pDraw)->depth \
+ != (xaaWrapperGetScrPriv(((DrawablePtr)(pDraw))->pScreen))->depth)
+#else
+#define COND(pDraw) 1
+#endif
+
+static Bool xaaWrapperCreateGC(GCPtr pGC);
+static void xaaWrapperValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDraw);
+static void xaaWrapperDestroyGC(GCPtr pGC);
+static void xaaWrapperChangeGC (GCPtr pGC, unsigned long mask);
+static void xaaWrapperCopyGC (GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst);
+static void xaaWrapperChangeClip (GCPtr pGC, int type, pointer pvalue, int nrects);
+
+static void xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc);
+static void xaaWrapperDestroyClip(GCPtr pGC);
+
+
+static void
+xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height);
+static void
+xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs);
+
+
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
+ CreateScreenResourcesProcPtr CreateScreenResources;
+ CreateWindowProcPtr CreateWindow;
+ CopyWindowProcPtr CopyWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CreateGCProcPtr CreateGC;
+ CreateColormapProcPtr CreateColormap;
+ DestroyColormapProcPtr DestroyColormap;
+ InstallColormapProcPtr InstallColormap;
+ UninstallColormapProcPtr UninstallColormap;
+ ListInstalledColormapsProcPtr ListInstalledColormaps;
+ StoreColorsProcPtr StoreColors;
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+
+ CloseScreenProcPtr wrapCloseScreen;
+ CreateScreenResourcesProcPtr wrapCreateScreenResources;
+ CreateWindowProcPtr wrapCreateWindow;
+ CopyWindowProcPtr wrapCopyWindow;
+ WindowExposuresProcPtr wrapWindowExposures;
+ CreateGCProcPtr wrapCreateGC;
+ CreateColormapProcPtr wrapCreateColormap;
+ DestroyColormapProcPtr wrapDestroyColormap;
+ InstallColormapProcPtr wrapInstallColormap;
+ UninstallColormapProcPtr wrapUninstallColormap;
+ ListInstalledColormapsProcPtr wrapListInstalledColormaps;
+ StoreColorsProcPtr wrapStoreColors;
+ CompositeProcPtr wrapComposite;
+ GlyphsProcPtr wrapGlyphs;
+ int depth;
+} xaaWrapperScrPrivRec, *xaaWrapperScrPrivPtr;
+
+#define xaaWrapperGetScrPriv(s) ((xaaWrapperScrPrivPtr) \
+ dixLookupPrivate(&(s)->devPrivates, xaaWrapperScrPrivateKey))
+#define xaaWrapperScrPriv(s) xaaWrapperScrPrivPtr pScrPriv = xaaWrapperGetScrPriv(s)
+
+#define wrap(priv,real,mem,func) {\
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define unwrap(priv,real,mem) {\
+ real->mem = priv->mem; \
+}
+
+#define cond_wrap(priv,cond,real,mem,wrapmem,func) {\
+ if (COND(cond)) \
+ priv->wrapmem = real->mem; \
+ else \
+ priv->mem = real->mem; \
+ real->mem = func; \
+}
+
+#define cond_unwrap(priv,cond,real,mem,wrapmem) {\
+ if (COND(cond)) \
+ real->mem = priv->wrapmem; \
+ else \
+ real->mem = priv->mem; \
+}
+
+#define get(priv,real,func,wrap) \
+ priv->wrap = real->func;
+
+typedef struct _xaaWrapperGCPriv {
+ GCOps *ops;
+ Bool wrap;
+ GCFuncs *funcs;
+ GCOps *wrapops;
+} xaaWrapperGCPrivRec, *xaaWrapperGCPrivPtr;
+
+#define xaaWrapperGetGCPriv(pGC) ((xaaWrapperGCPrivPtr) \
+ dixLookupPrivate(&(pGC)->devPrivates, xaaWrapperGCPrivateKey))
+#define xaaWrapperGCPriv(pGC) xaaWrapperGCPrivPtr pGCPriv = xaaWrapperGetGCPriv(pGC)
+
+
+static int xaaWrapperScrPrivateKeyIndex;
+static DevPrivateKey xaaWrapperScrPrivateKey = &xaaWrapperScrPrivateKeyIndex;
+static int xaaWrapperGCPrivateKeyIndex;
+static DevPrivateKey xaaWrapperGCPrivateKey = &xaaWrapperGCPrivateKeyIndex;
+
+static Bool
+xaaWrapperCreateScreenResources(ScreenPtr pScreen)
+{
+ xaaWrapperScrPriv(pScreen);
+ Bool ret;
+
+ unwrap (pScrPriv,pScreen, CreateScreenResources);
+ ret = pScreen->CreateScreenResources(pScreen);
+ wrap(pScrPriv,pScreen,CreateScreenResources,xaaWrapperCreateScreenResources);
+ return ret;
+}
+
+static Bool
+xaaWrapperCloseScreen (int iScreen, ScreenPtr pScreen)
+{
+ xaaWrapperScrPriv(pScreen);
+ Bool ret;
+
+ unwrap (pScrPriv,pScreen, CloseScreen);
+ ret = pScreen->CloseScreen(iScreen,pScreen);
+ return TRUE;
+}
+
+static Bool
+xaaWrapperCreateWindow(WindowPtr pWin)
+{
+ xaaWrapperScrPriv(pWin->drawable.pScreen);
+ Bool ret;
+
+ cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
+ CreateWindow, wrapCreateWindow);
+ ret = pWin->drawable.pScreen->CreateWindow(pWin);
+ cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen, CreateWindow,
+ wrapCreateWindow, xaaWrapperCreateWindow);
+
+ return ret;
+}
+
+static void
+xaaWrapperCopyWindow(WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc)
+{
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap (pScrPriv, pScreen, CopyWindow);
+#if 0
+ if (COND(&pWin->drawable))
+ pWin->drawable.pScreen->CopyWindow = pScrPriv->wrapCopyWindow;
+#endif
+ pScreen->CopyWindow(pWin, ptOldOrg, prgnSrc);
+ wrap(pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
+}
+
+static void
+xaaWrapperWindowExposures (WindowPtr pWin,
+ RegionPtr prgn,
+ RegionPtr other_exposed)
+{
+ xaaWrapperScrPriv(pWin->drawable.pScreen);
+
+ cond_unwrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
+ WindowExposures, wrapWindowExposures);
+ pWin->drawable.pScreen->WindowExposures(pWin, prgn, other_exposed);
+ cond_wrap(pScrPriv, &pWin->drawable, pWin->drawable.pScreen,
+ WindowExposures, wrapWindowExposures, xaaWrapperWindowExposures);
+}
+
+static Bool
+xaaWrapperCreateColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+ Bool ret;
+ unwrap(pScrPriv,pmap->pScreen, CreateColormap);
+ ret = pmap->pScreen->CreateColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,CreateColormap,xaaWrapperCreateColormap);
+
+ return ret;
+}
+
+static void
+xaaWrapperDestroyColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+ unwrap(pScrPriv,pmap->pScreen, DestroyColormap);
+ pmap->pScreen->DestroyColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,DestroyColormap,xaaWrapperDestroyColormap);
+}
+
+static void
+xaaWrapperStoreColors(ColormapPtr pmap, int nColors, xColorItem *pColors)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+ unwrap(pScrPriv,pmap->pScreen, StoreColors);
+ pmap->pScreen->StoreColors(pmap,nColors,pColors);
+ wrap(pScrPriv,pmap->pScreen,StoreColors,xaaWrapperStoreColors);
+}
+
+static void
+xaaWrapperInstallColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+
+ unwrap(pScrPriv,pmap->pScreen, InstallColormap);
+ pmap->pScreen->InstallColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,InstallColormap,xaaWrapperInstallColormap);
+}
+
+static void
+xaaWrapperUninstallColormap(ColormapPtr pmap)
+{
+ xaaWrapperScrPriv(pmap->pScreen);
+
+ unwrap(pScrPriv,pmap->pScreen, UninstallColormap);
+ pmap->pScreen->UninstallColormap(pmap);
+ wrap(pScrPriv,pmap->pScreen,UninstallColormap,xaaWrapperUninstallColormap);
+}
+
+static int
+xaaWrapperListInstalledColormaps(ScreenPtr pScreen, Colormap *pCmapIds)
+{
+ int n;
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap(pScrPriv,pScreen, ListInstalledColormaps);
+ n = pScreen->ListInstalledColormaps(pScreen, pCmapIds);
+ wrap (pScrPriv,pScreen,ListInstalledColormaps,xaaWrapperListInstalledColormaps);
+ return n;
+}
+
+Bool
+xaaSetupWrapper(ScreenPtr pScreen, XAAInfoRecPtr infoPtr, int depth, SyncFunc *func)
+{
+ Bool ret;
+ xaaWrapperScrPrivPtr pScrPriv;
+ PictureScreenPtr ps = GetPictureScreenIfSet(pScreen);
+
+ if (!dixRequestPrivate(xaaWrapperGCPrivateKey, sizeof(xaaWrapperGCPrivRec)))
+ return FALSE;
+
+ pScrPriv = (xaaWrapperScrPrivPtr) malloc(sizeof (xaaWrapperScrPrivRec));
+ if (!pScrPriv)
+ return FALSE;
+
+ get (pScrPriv, pScreen, CloseScreen, wrapCloseScreen);
+ get (pScrPriv, pScreen, CreateScreenResources, wrapCreateScreenResources);
+ get (pScrPriv, pScreen, CreateWindow, wrapCreateWindow);
+ get (pScrPriv, pScreen, CopyWindow, wrapCopyWindow);
+ get (pScrPriv, pScreen, WindowExposures, wrapWindowExposures);
+ get (pScrPriv, pScreen, CreateGC, wrapCreateGC);
+ get (pScrPriv, pScreen, CreateColormap, wrapCreateColormap);
+ get (pScrPriv, pScreen, DestroyColormap, wrapDestroyColormap);
+ get (pScrPriv, pScreen, InstallColormap, wrapInstallColormap);
+ get (pScrPriv, pScreen, UninstallColormap, wrapUninstallColormap);
+ get (pScrPriv, pScreen, ListInstalledColormaps, wrapListInstalledColormaps);
+ get (pScrPriv, pScreen, StoreColors, wrapStoreColors);
+ if (ps) {
+ get (pScrPriv, ps, Glyphs, wrapGlyphs);
+ get (pScrPriv, ps, Composite, wrapComposite);
+ }
+ if (!(ret = XAAInit(pScreen,infoPtr)))
+ return FALSE;
+
+ wrap (pScrPriv, pScreen, CloseScreen, xaaWrapperCloseScreen);
+ wrap (pScrPriv, pScreen, CreateScreenResources,
+ xaaWrapperCreateScreenResources);
+ wrap (pScrPriv, pScreen, CreateWindow, xaaWrapperCreateWindow);
+ wrap (pScrPriv, pScreen, CopyWindow, xaaWrapperCopyWindow);
+ wrap (pScrPriv, pScreen, WindowExposures, xaaWrapperWindowExposures);
+ wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
+ wrap (pScrPriv, pScreen, CreateColormap, xaaWrapperCreateColormap);
+ wrap (pScrPriv, pScreen, DestroyColormap, xaaWrapperDestroyColormap);
+ wrap (pScrPriv, pScreen, InstallColormap, xaaWrapperInstallColormap);
+ wrap (pScrPriv, pScreen, UninstallColormap, xaaWrapperUninstallColormap);
+ wrap (pScrPriv, pScreen, ListInstalledColormaps,
+ xaaWrapperListInstalledColormaps);
+ wrap (pScrPriv, pScreen, StoreColors, xaaWrapperStoreColors);
+
+ if (ps) {
+ wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
+ wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
+ }
+ pScrPriv->depth = depth;
+ dixSetPrivate(&pScreen->devPrivates, xaaWrapperScrPrivateKey, pScrPriv);
+
+ *func = XAASync;
+
+ return ret;
+}
+
+GCFuncs xaaWrapperGCFuncs = {
+ xaaWrapperValidateGC, xaaWrapperChangeGC, xaaWrapperCopyGC,
+ xaaWrapperDestroyGC, xaaWrapperChangeClip, xaaWrapperDestroyClip,
+ xaaWrapperCopyClip
+};
+
+#define XAAWRAPPER_GC_FUNC_PROLOGUE(pGC) \
+ xaaWrapperGCPriv(pGC); \
+ unwrap(pGCPriv, pGC, funcs); \
+ if (pGCPriv->wrap) unwrap(pGCPriv, pGC, ops)
+
+#define XAAWRAPPER_GC_FUNC_EPILOGUE(pGC) \
+ wrap(pGCPriv, pGC, funcs, &xaaWrapperGCFuncs); \
+ if (pGCPriv->wrap) wrap(pGCPriv, pGC, ops, pGCPriv->wrapops)
+
+static Bool
+xaaWrapperCreateGC(GCPtr pGC)
+{
+ ScreenPtr pScreen = pGC->pScreen;
+ xaaWrapperScrPriv(pScreen);
+ xaaWrapperGCPriv(pGC);
+ Bool ret;
+
+ unwrap (pScrPriv, pScreen, CreateGC);
+ if((ret = (*pScreen->CreateGC) (pGC))) {
+ pGCPriv->wrap = FALSE;
+ pGCPriv->funcs = pGC->funcs;
+ pGCPriv->wrapops = pGC->ops;
+ pGC->funcs = &xaaWrapperGCFuncs;
+ }
+ wrap (pScrPriv, pScreen, CreateGC, xaaWrapperCreateGC);
+
+ return ret;
+}
+
+static void
+xaaWrapperValidateGC(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ValidateGC)(pGC, changes, pDraw);
+
+ if(COND(pDraw))
+ pGCPriv->wrap = TRUE;
+
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperDestroyGC(GCPtr pGC)
+{
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->DestroyGC)(pGC);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperChangeGC (
+ GCPtr pGC,
+ unsigned long mask
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeGC) (pGC, mask);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperCopyGC (
+ GCPtr pGCSrc,
+ unsigned long mask,
+ GCPtr pGCDst
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGCDst);
+ (*pGCDst->funcs->CopyGC) (pGCSrc, mask, pGCDst);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGCDst);
+}
+
+static void
+xaaWrapperChangeClip (
+ GCPtr pGC,
+ int type,
+ pointer pvalue,
+ int nrects
+){
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (*pGC->funcs->ChangeClip) (pGC, type, pvalue, nrects);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
+{
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pgcDst);
+ (* pgcDst->funcs->CopyClip)(pgcDst, pgcSrc);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pgcDst);
+}
+
+static void
+xaaWrapperDestroyClip(GCPtr pGC)
+{
+ XAAWRAPPER_GC_FUNC_PROLOGUE (pGC);
+ (* pGC->funcs->DestroyClip)(pGC);
+ XAAWRAPPER_GC_FUNC_EPILOGUE (pGC);
+}
+
+static void
+xaaWrapperComposite (CARD8 op, PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst,
+ INT16 xSrc, INT16 ySrc, INT16 xMask, INT16 yMask,
+ INT16 xDst, INT16 yDst, CARD16 width, CARD16 height)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap (pScrPriv, ps, Composite);
+ (*ps->Composite) (op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask,
+ xDst, yDst, width, height);
+ wrap (pScrPriv, ps, Composite, xaaWrapperComposite);
+}
+
+
+static void
+xaaWrapperGlyphs (CARD8 op, PicturePtr pSrc, PicturePtr pDst,
+ PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlist,
+ GlyphListPtr list, GlyphPtr *glyphs)
+{
+ ScreenPtr pScreen = pDst->pDrawable->pScreen;
+ PictureScreenPtr ps = GetPictureScreen(pScreen);
+ xaaWrapperScrPriv(pScreen);
+
+ unwrap (pScrPriv, ps, Glyphs);
+ (*ps->Glyphs) (op, pSrc, pDst, maskFormat, xSrc, ySrc,
+ nlist, list, glyphs);
+ wrap (pScrPriv, ps, Glyphs, xaaWrapperGlyphs);
+
+}
+
+void
+XAASync(ScreenPtr pScreen)
+{
+ XAAScreenPtr pScreenPriv = (XAAScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, XAAGetScreenKey());
+ XAAInfoRecPtr infoRec = pScreenPriv->AccelInfoRec;
+
+ if(infoRec->NeedToSync) {
+ (*infoRec->Sync)(infoRec->pScrn);
+ infoRec->NeedToSync = FALSE;
+ }
+}
diff --git a/xorg-server/hw/xfree86/xaa/xaalocal.h b/xorg-server/hw/xfree86/xaa/xaalocal.h
index 129c1d6c4..6c492c013 100644
--- a/xorg-server/hw/xfree86/xaa/xaalocal.h
+++ b/xorg-server/hw/xfree86/xaa/xaalocal.h
@@ -1,1755 +1,1755 @@
-
-#ifndef _XAALOCAL_H
-#define _XAALOCAL_H
-
-/* This file is very unorganized ! */
-
-
-#include "gcstruct.h"
-#include "regionstr.h"
-#include "xf86fbman.h"
-#include "xaa.h"
-#include "mi.h"
-#include "picturestr.h"
-
-#define GCWhenForced (GCArcMode << 1)
-
-#define DO_COLOR_8x8 0x00000001
-#define DO_MONO_8x8 0x00000002
-#define DO_CACHE_BLT 0x00000003
-#define DO_COLOR_EXPAND 0x00000004
-#define DO_CACHE_EXPAND 0x00000005
-#define DO_IMAGE_WRITE 0x00000006
-#define DO_PIXMAP_COPY 0x00000007
-#define DO_SOLID 0x00000008
-
-
-typedef CARD32 * (*GlyphScanlineFuncPtr)(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
-
-typedef CARD32 *(*StippleScanlineProcPtr)(CARD32*, CARD32*, int, int, int);
-
-typedef void (*RectFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
- XAACacheInfoPtr);
-typedef void (*TrapFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
- int, int, int, int, int, int,
- XAACacheInfoPtr);
-
-
-
-typedef struct _XAAScreen {
- CreateGCProcPtr CreateGC;
- CloseScreenProcPtr CloseScreen;
- GetImageProcPtr GetImage;
- GetSpansProcPtr GetSpans;
- CopyWindowProcPtr CopyWindow;
- WindowExposuresProcPtr WindowExposures;
- CreatePixmapProcPtr CreatePixmap;
- DestroyPixmapProcPtr DestroyPixmap;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
- XAAInfoRecPtr AccelInfoRec;
- Bool (*EnterVT)(int, int);
- void (*LeaveVT)(int, int);
- int (*SetDGAMode)(int, int, DGADevicePtr);
- void (*EnableDisableFBAccess)(int, Bool);
- CompositeProcPtr Composite;
- GlyphsProcPtr Glyphs;
-} XAAScreenRec, *XAAScreenPtr;
-
-#define OPS_ARE_PIXMAP 0x00000001
-#define OPS_ARE_ACCEL 0x00000002
-
-typedef struct _XAAGC {
- GCOps *wrapOps;
- GCFuncs *wrapFuncs;
- GCOps *XAAOps;
- int DashLength;
- unsigned char* DashPattern;
- unsigned long changes;
- unsigned long flags;
-} XAAGCRec, *XAAGCPtr;
-
-#define REDUCIBILITY_CHECKED 0x00000001
-#define REDUCIBLE_TO_8x8 0x00000002
-#define REDUCIBLE_TO_2_COLOR 0x00000004
-#define DIRTY 0x00010000
-#define OFFSCREEN 0x00020000
-#define DGA_PIXMAP 0x00040000
-#define SHARED_PIXMAP 0x00080000
-#define LOCKED_PIXMAP 0x00100000
-
-#define REDUCIBILITY_MASK \
- (REDUCIBILITY_CHECKED | REDUCIBLE_TO_8x8 | REDUCIBLE_TO_2_COLOR)
-
-typedef struct _XAAPixmap {
- unsigned long flags;
- CARD32 pattern0;
- CARD32 pattern1;
- int fg;
- int bg;
- FBAreaPtr offscreenArea;
- Bool freeData;
-} XAAPixmapRec, *XAAPixmapPtr;
-
-
-extern _X_EXPORT Bool
-XAACreateGC(
- GCPtr pGC
-);
-
-extern _X_EXPORT Bool
-XAAInitAccel(
- ScreenPtr pScreen,
- XAAInfoRecPtr infoRec
-);
-
-extern _X_EXPORT RegionPtr
-XAABitBlt(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
- unsigned long bitPlane
-);
-
-extern _X_EXPORT void
-XAAScreenToScreenBitBlt(
- ScrnInfoPtr pScrn,
- int nbox,
- DDXPointPtr pptSrc,
- BoxPtr pbox,
- int xdir,
- int ydir,
- int alu,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAADoBitBlt(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc
-);
-
-extern _X_EXPORT void
-XAADoImageWrite(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc
-);
-
-extern _X_EXPORT void
-XAADoImageRead(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GC *pGC,
- RegionPtr prgnDst,
- DDXPointPtr pptSrc
-);
-
-extern _X_EXPORT void
-XAACopyWindow(
- WindowPtr pWin,
- DDXPointRec ptOldOrg,
- RegionPtr prgnSrc
-);
-
-
-extern _X_EXPORT RegionPtr
-XAACopyArea(
- DrawablePtr pSrcDrawable,
- DrawablePtr pDstDrawable,
- GC *pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty
-);
-
-extern _X_EXPORT void
-XAAValidateCopyArea(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidatePutImage(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidateCopyPlane(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidatePushPixels(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidateFillSpans(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidatePolyGlyphBlt(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidateImageGlyphBlt(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-extern _X_EXPORT void
-XAAValidatePolylines(
- GCPtr pGC,
- unsigned long changes,
- DrawablePtr pDraw
-);
-
-
-extern _X_EXPORT RegionPtr
-XAACopyPlaneColorExpansion(
- DrawablePtr pSrc,
- DrawablePtr pDst,
- GCPtr pGC,
- int srcx,
- int srcy,
- int width,
- int height,
- int dstx,
- int dsty,
- unsigned long bitPlane
-);
-
-
-extern _X_EXPORT void
-XAAPushPixelsSolidColorExpansion(
- GCPtr pGC,
- PixmapPtr pBitMap,
- DrawablePtr pDrawable,
- int dx,
- int dy,
- int xOrg,
- int yOrg
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandMSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3MSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandLSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3LSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpandLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapColorExpand3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int skipleft,
- int fg, int bg,
- int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAWritePixmap (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-);
-
-extern _X_EXPORT void
-XAAWritePixmapScanline (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int rop,
- unsigned int planemask,
- int transparency_color,
- int bpp, int depth
-);
-
-typedef void (*ClipAndRenderRectsFunc)(GCPtr, int, BoxPtr, int, int);
-
-
-extern _X_EXPORT void
-XAAClipAndRenderRects(
- GCPtr pGC,
- ClipAndRenderRectsFunc func,
- int nrectFill,
- xRectangle *prectInit,
- int xorg, int yorg
-);
-
-
-typedef void (*ClipAndRenderSpansFunc)(GCPtr, int, DDXPointPtr, int*,
- int, int, int);
-
-extern _X_EXPORT void
-XAAClipAndRenderSpans(
- GCPtr pGC,
- DDXPointPtr ppt,
- int *pwidth,
- int nspans,
- int fSorted,
- ClipAndRenderSpansFunc func,
- int xorg,
- int yorg
-);
-
-
-extern _X_EXPORT void
-XAAFillSolidRects(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternRects(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pat0, int pat1,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternRectsScreenOrigin(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int pat0, int pat1,
- int xorg, int yorg
-);
-
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternRectsScreenOrigin(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorigin, int yorigin,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorigin, int yorigin,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAFillCacheBltRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAFillCacheExpandRects(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillImageWriteRects(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAPolyFillRect(
- DrawablePtr pDraw,
- GCPtr pGC,
- int nrectFill,
- xRectangle *prectInit
-);
-
-
-extern _X_EXPORT void
-XAATEGlyphRendererMSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRenderer3MSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRenderer3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererLSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-
-extern _X_EXPORT void
-XAATEGlyphRenderer3LSBFirstFixedBase (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRenderer3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-
-extern _X_EXPORT void
-XAATEGlyphRendererScanlineMSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererScanline3MSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererScanlineLSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-extern _X_EXPORT void
-XAATEGlyphRendererScanline3LSBFirst (
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h, int skipleft, int startline,
- unsigned int **glyphs, int glyphWidth,
- int fg, int bg, int rop, unsigned planemask
-);
-
-
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
-
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
-
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
-
-extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32])(
- CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
-);
-
-extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void);
-extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirst(void);
-extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void);
-extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirst(void);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsLSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3LSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRectsMSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandRects3MSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRectsLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRects3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRectsMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandRects3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int nBox,
- BoxPtr pBox,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansLSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3LSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpansMSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillColorExpandSpans3MSBFirstFixedBase(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpansLSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpans3LSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAPutImage(
- DrawablePtr pDraw,
- GCPtr pGC,
- int depth,
- int x,
- int y,
- int w,
- int h,
- int leftPad,
- int format,
- char *pImage
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpansMSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillScanlineColorExpandSpans3MSBFirst(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirst[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirst[6])(
- CARD32* base, CARD32* src, int offset, int width, int dwords
-);
-
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirst(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void);
-extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirst(void);
-
-extern _X_EXPORT int
-XAAPolyText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
-
-extern _X_EXPORT int
-XAAPolyText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageText8TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
-
-extern _X_EXPORT void
-XAAImageText16TEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-extern _X_EXPORT void
-XAAPolyGlyphBltTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-
-extern _X_EXPORT int
-XAAPolyText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
-
-extern _X_EXPORT int
-XAAPolyText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageText8NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- char *chars
-);
-
-extern _X_EXPORT void
-XAAImageText16NonTEColorExpansion(
- DrawablePtr pDraw,
- GCPtr pGC,
- int x, int y,
- int count,
- unsigned short *chars
-);
-
-extern _X_EXPORT void
-XAAImageGlyphBltNonTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-extern _X_EXPORT void
-XAAPolyGlyphBltNonTEColorExpansion(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int xInit, int yInit,
- unsigned int nglyph,
- CharInfoPtr *ppci,
- pointer pglyphBase
-);
-
-
-extern _X_EXPORT void XAANonTEGlyphRenderer(
- ScrnInfoPtr pScrn,
- int x, int y, int n,
- NonTEGlyphPtr glyphs,
- BoxPtr pbox,
- int fg, int rop,
- unsigned int planemask
-);
-
-extern _X_EXPORT void
-XAAFillSolidSpans(
- ScrnInfoPtr pScrn,
- int fg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternSpans(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- int patx, int paty,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillMono8x8PatternSpansScreenOrigin(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- int patx, int paty,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternSpansScreenOrigin(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- XAACacheInfoPtr,
- int xorigin, int yorigin
-);
-
-extern _X_EXPORT void
-XAAFillColor8x8PatternSpans(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth, int fSorted,
- XAACacheInfoPtr,
- int xorigin, int yorigin
-);
-
-extern _X_EXPORT void
-XAAFillCacheBltSpans(
- ScrnInfoPtr pScrn,
- int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr points,
- int *widths,
- int fSorted,
- XAACacheInfoPtr pCache,
- int xorg, int yorg
-);
-
-extern _X_EXPORT void
-XAAFillCacheExpandSpans(
- ScrnInfoPtr pScrn,
- int fg, int bg, int rop,
- unsigned int planemask,
- int n,
- DDXPointPtr ppt,
- int *pwidth,
- int fSorted,
- int xorg, int yorg,
- PixmapPtr pPix
-);
-
-extern _X_EXPORT void
-XAAFillSpans(
- DrawablePtr pDrawable,
- GC *pGC,
- int nInit,
- DDXPointPtr pptInit,
- int *pwidth,
- int fSorted
-);
-
-
-extern _X_EXPORT void
-XAAInitPixmapCache(
- ScreenPtr pScreen,
- RegionPtr areas,
- pointer data
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-);
-
-extern _X_EXPORT void
-XAAWriteBitmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int fg, int bg
-);
-
-extern _X_EXPORT void
-XAAWritePixmapToCache(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-);
-
-extern _X_EXPORT void
-XAAWritePixmapToCacheLinear(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned char *src,
- int srcwidth,
- int bpp, int depth
-);
-
-extern _X_EXPORT void
-XAASolidHorVertLineAsRects(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-);
-
-extern _X_EXPORT void
-XAASolidHorVertLineAsTwoPoint(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-);
-
-extern _X_EXPORT void
-XAASolidHorVertLineAsBresenham(
- ScrnInfoPtr pScrn,
- int x, int y, int len, int dir
-);
-
-
-extern _X_EXPORT void
-XAAPolyRectangleThinSolid(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nRectsInit,
- xRectangle *pRectsInit
-);
-
-
-extern _X_EXPORT void
-XAAPolylinesWideSolid (
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pPts
-);
-
-extern _X_EXPORT void
-XAAFillPolygonSolid(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-);
-
-extern _X_EXPORT void
-XAAFillPolygonStippled(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-);
-
-
-extern _X_EXPORT void
-XAAFillPolygonTiled(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int shape,
- int mode,
- int count,
- DDXPointPtr ptsIn
-);
-
-
-extern _X_EXPORT int
-XAAIsEasyPolygon(
- DDXPointPtr ptsIn,
- int count,
- BoxPtr extents,
- int origin,
- DDXPointPtr *topPoint,
- int *topY, int *bottomY,
- int shape
-);
-
-extern _X_EXPORT void
-XAAFillPolygonHelper(
- ScrnInfoPtr pScrn,
- DDXPointPtr ptsIn,
- int count,
- DDXPointPtr topPoint,
- int y,
- int maxy,
- int origin,
- RectFuncPtr RectFunc,
- TrapFuncPtr TrapFunc,
- int xorg,
- int yorg,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAAPolySegment(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-);
-
-extern _X_EXPORT void
-XAAPolyLines(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-);
-
-extern _X_EXPORT void
-XAAPolySegmentDashed(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int nseg,
- xSegment *pSeg
-);
-
-extern _X_EXPORT void
-XAAPolyLinesDashed(
- DrawablePtr pDrawable,
- GCPtr pGC,
- int mode,
- int npt,
- DDXPointPtr pptInit
-);
-
-
-extern _X_EXPORT void
-XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache);
-
-extern _X_EXPORT void
-XAAWriteColor8x8PatternToCache(
- ScrnInfoPtr pScrn,
- PixmapPtr pPix,
- XAACacheInfoPtr pCache
-);
-
-extern _X_EXPORT void
-XAARotateMonoPattern(
- int *pat0, int *pat1,
- int xoffset, int yoffset,
- Bool msbfirst
-);
-
-extern _X_EXPORT void XAAComputeDash(GCPtr pGC);
-
-extern _X_EXPORT void XAAMoveDWORDS_FixedBase(
- register CARD32* dest,
- register CARD32* src,
- register int dwords
-);
-
-extern _X_EXPORT void XAAMoveDWORDS_FixedSrc(
- register CARD32* dest,
- register CARD32* src,
- register int dwords
-);
-
-extern _X_EXPORT void XAAMoveDWORDS(
- register CARD32* dest,
- register CARD32* src,
- register int dwords
-);
-
-extern _X_EXPORT int
-XAAGetRectClipBoxes(
- GCPtr pGC,
- BoxPtr pboxClippedBase,
- int nrectFill,
- xRectangle *prectInit
-);
-
-extern _X_EXPORT void
-XAASetupOverlay8_32Planar(ScreenPtr);
-
-extern _X_EXPORT void
-XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACachePlanarMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
-
-typedef XAACacheInfoPtr (*XAACachePlanarMonoStippleProc)(ScrnInfoPtr, PixmapPtr);
-extern _X_EXPORT XAACachePlanarMonoStippleProc XAAGetCachePlanarMonoStipple(void);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACacheStipple(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACacheMono8x8Pattern(ScrnInfoPtr Scrn, int pat0, int pat1);
-
-extern _X_EXPORT XAACacheInfoPtr
-XAACacheColor8x8Pattern(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
-
-extern _X_EXPORT void
-XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h);
-
-extern _X_EXPORT void XAAClosePixmapCache(ScreenPtr pScreen);
-void XAAInvalidatePixmapCache(ScreenPtr pScreen);
-
-extern _X_EXPORT Bool XAACheckStippleReducibility(PixmapPtr pPixmap);
-extern _X_EXPORT Bool XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono);
-
-extern _X_EXPORT int XAAStippledFillChooser(GCPtr pGC);
-extern _X_EXPORT int XAAOpaqueStippledFillChooser(GCPtr pGC);
-extern _X_EXPORT int XAATiledFillChooser(GCPtr pGC);
-
-extern _X_EXPORT void XAAMoveInOffscreenPixmaps(ScreenPtr pScreen);
-extern _X_EXPORT void XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen);
-extern _X_EXPORT void XAARemoveAreaCallback(FBAreaPtr area);
-extern _X_EXPORT void XAAMoveOutOffscreenPixmap(PixmapPtr pPix);
-extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
-
-extern _X_EXPORT void
-XAAComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-
-extern _X_EXPORT Bool
-XAADoComposite (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pMask,
- PicturePtr pDst,
- INT16 xSrc,
- INT16 ySrc,
- INT16 xMask,
- INT16 yMask,
- INT16 xDst,
- INT16 yDst,
- CARD16 width,
- CARD16 height);
-
-
-extern _X_EXPORT void
-XAAGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-
-extern _X_EXPORT Bool
-XAADoGlyphs (CARD8 op,
- PicturePtr pSrc,
- PicturePtr pDst,
- PictFormatPtr maskFormat,
- INT16 xSrc,
- INT16 ySrc,
- int nlist,
- GlyphListPtr list,
- GlyphPtr *glyphs);
-
-
-
-/* helpers */
-extern _X_EXPORT void
-XAA_888_plus_PICT_a8_to_8888 (
- CARD32 color,
- CARD8 *alphaPtr, /* in bytes */
- int alphaPitch,
- CARD32 *dstPtr,
- int dstPitch, /* in dwords */
- int width,
- int height
-);
-
-extern _X_EXPORT Bool
-XAAGetRGBAFromPixel(
- CARD32 pixel,
- CARD16 *red,
- CARD16 *green,
- CARD16 *blue,
- CARD16 *alpha,
- CARD32 format
-);
-
-
-extern _X_EXPORT Bool
-XAAGetPixelFromRGBA (
- CARD32 *pixel,
- CARD16 red,
- CARD16 green,
- CARD16 blue,
- CARD16 alpha,
- CARD32 format
-);
-
-/* XXX should be static */
-extern _X_EXPORT GCOps XAAFallbackOps;
-extern _X_EXPORT GCOps *XAAGetFallbackOps(void);
-extern _X_EXPORT GCFuncs XAAGCFuncs;
-extern _X_EXPORT DevPrivateKey XAAGetScreenKey(void);
-extern _X_EXPORT DevPrivateKey XAAGetGCKey(void);
-extern _X_EXPORT DevPrivateKey XAAGetPixmapKey(void);
-
-extern _X_EXPORT unsigned int XAAShiftMasks[32];
-
-extern _X_EXPORT unsigned int byte_expand3[256], byte_reversed_expand3[256];
-
-extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
-
-#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\
- dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey())
-
-#define GET_XAASCREENPTR_FROM_GC(pGC)\
- dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey())
-
-#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\
- dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey())
-
-#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\
-((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec
-
-#define GET_XAAINFORECPTR_FROM_GC(pGC)\
-((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
-
-#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\
-((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
-
-#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\
-((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
-
-#define XAA_GET_PIXMAP_PRIVATE(pix)\
- (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey())
-
-#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
-
-#define CHECK_FG(pGC, flags) \
- (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->fgPixel))
-
-#define CHECK_BG(pGC, flags) \
- (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->bgPixel))
-
-#define CHECK_ROP(pGC, flags) \
- (!(flags & GXCOPY_ONLY) || (pGC->alu == GXcopy))
-
-#define CHECK_ROPSRC(pGC, flags) \
- (!(flags & ROP_NEEDS_SOURCE) || ((pGC->alu != GXclear) && \
- (pGC->alu != GXnoop) && (pGC->alu != GXinvert) && \
- (pGC->alu != GXset)))
-
-#define CHECK_PLANEMASK(pGC, flags) \
- (!(flags & NO_PLANEMASK) || \
- ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == \
- infoRec->FullPlanemasks[pGC->depth - 1]))
-
-#define CHECK_COLORS(pGC, flags) \
- (!(flags & RGB_EQUAL) || \
- (CHECK_RGB_EQUAL(pGC->fgPixel) && CHECK_RGB_EQUAL(pGC->bgPixel)))
-
-#define CHECK_NO_GXCOPY(pGC, flags) \
- ((pGC->alu != GXcopy) || !(flags & NO_GXCOPY) || \
- ((pGC->planemask & infoRec->FullPlanemask) != infoRec->FullPlanemask))
-
-#define IS_OFFSCREEN_PIXMAP(pPix)\
- ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)
-
-#define PIXMAP_IS_SHARED(pPix)\
- ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & SHARED_PIXMAP)
-
-#define OFFSCREEN_PIXMAP_LOCKED(pPix)\
- ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & LOCKED_PIXMAP)
-
-#define XAA_DEPTH_BUG(pGC) \
- ((pGC->depth == 32) && (pGC->bgPixel == 0xffffffff))
-
-#define DELIST_OFFSCREEN_PIXMAP(pPix) { \
- PixmapLinkPtr _pLink, _prev; \
- _pLink = infoRec->OffscreenPixmaps; \
- _prev = NULL; \
- while(_pLink) { \
- if(_pLink->pPix == pPix) { \
- if(_prev) _prev->next = _pLink->next; \
- else infoRec->OffscreenPixmaps = _pLink->next; \
- xfree(_pLink); \
- break; \
- } \
- _prev = _pLink; \
- _pLink = _pLink->next; \
- }}
-
-
-#define SWAP_BITS_IN_BYTES(v) \
- (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \
- ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \
- ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \
- ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7))
-
-/*
- * Moved XAAPixmapCachePrivate here from xaaPCache.c, since driver
- * replacements for CacheMonoStipple need access to it
- */
-
-typedef struct {
- int Num512x512;
- int Current512;
- XAACacheInfoPtr Info512;
- int Num256x256;
- int Current256;
- XAACacheInfoPtr Info256;
- int Num128x128;
- int Current128;
- XAACacheInfoPtr Info128;
- int NumMono;
- int CurrentMono;
- XAACacheInfoPtr InfoMono;
- int NumColor;
- int CurrentColor;
- XAACacheInfoPtr InfoColor;
- int NumPartial;
- int CurrentPartial;
- XAACacheInfoPtr InfoPartial;
- DDXPointRec MonoOffsets[64];
- DDXPointRec ColorOffsets[64];
-} XAAPixmapCachePrivate, *XAAPixmapCachePrivatePtr;
-
-
-#endif /* _XAALOCAL_H */
+
+#ifndef _XAALOCAL_H
+#define _XAALOCAL_H
+
+/* This file is very unorganized ! */
+
+
+#include "gcstruct.h"
+#include "regionstr.h"
+#include "xf86fbman.h"
+#include "xaa.h"
+#include "mi.h"
+#include "picturestr.h"
+
+#define GCWhenForced (GCArcMode << 1)
+
+#define DO_COLOR_8x8 0x00000001
+#define DO_MONO_8x8 0x00000002
+#define DO_CACHE_BLT 0x00000003
+#define DO_COLOR_EXPAND 0x00000004
+#define DO_CACHE_EXPAND 0x00000005
+#define DO_IMAGE_WRITE 0x00000006
+#define DO_PIXMAP_COPY 0x00000007
+#define DO_SOLID 0x00000008
+
+
+typedef CARD32 * (*GlyphScanlineFuncPtr)(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+typedef CARD32 *(*StippleScanlineProcPtr)(CARD32*, CARD32*, int, int, int);
+
+typedef void (*RectFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
+ XAACacheInfoPtr);
+typedef void (*TrapFuncPtr) (ScrnInfoPtr, int, int, int, int, int, int,
+ int, int, int, int, int, int,
+ XAACacheInfoPtr);
+
+
+
+typedef struct _XAAScreen {
+ CreateGCProcPtr CreateGC;
+ CloseScreenProcPtr CloseScreen;
+ GetImageProcPtr GetImage;
+ GetSpansProcPtr GetSpans;
+ CopyWindowProcPtr CopyWindow;
+ WindowExposuresProcPtr WindowExposures;
+ CreatePixmapProcPtr CreatePixmap;
+ DestroyPixmapProcPtr DestroyPixmap;
+ ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+ XAAInfoRecPtr AccelInfoRec;
+ Bool (*EnterVT)(int, int);
+ void (*LeaveVT)(int, int);
+ int (*SetDGAMode)(int, int, DGADevicePtr);
+ void (*EnableDisableFBAccess)(int, Bool);
+ CompositeProcPtr Composite;
+ GlyphsProcPtr Glyphs;
+} XAAScreenRec, *XAAScreenPtr;
+
+#define OPS_ARE_PIXMAP 0x00000001
+#define OPS_ARE_ACCEL 0x00000002
+
+typedef struct _XAAGC {
+ GCOps *wrapOps;
+ GCFuncs *wrapFuncs;
+ GCOps *XAAOps;
+ int DashLength;
+ unsigned char* DashPattern;
+ unsigned long changes;
+ unsigned long flags;
+} XAAGCRec, *XAAGCPtr;
+
+#define REDUCIBILITY_CHECKED 0x00000001
+#define REDUCIBLE_TO_8x8 0x00000002
+#define REDUCIBLE_TO_2_COLOR 0x00000004
+#define DIRTY 0x00010000
+#define OFFSCREEN 0x00020000
+#define DGA_PIXMAP 0x00040000
+#define SHARED_PIXMAP 0x00080000
+#define LOCKED_PIXMAP 0x00100000
+
+#define REDUCIBILITY_MASK \
+ (REDUCIBILITY_CHECKED | REDUCIBLE_TO_8x8 | REDUCIBLE_TO_2_COLOR)
+
+typedef struct _XAAPixmap {
+ unsigned long flags;
+ CARD32 pattern0;
+ CARD32 pattern1;
+ int fg;
+ int bg;
+ FBAreaPtr offscreenArea;
+ Bool freeData;
+} XAAPixmapRec, *XAAPixmapPtr;
+
+
+extern _X_EXPORT Bool
+XAACreateGC(
+ GCPtr pGC
+);
+
+extern _X_EXPORT Bool
+XAAInitAccel(
+ ScreenPtr pScreen,
+ XAAInfoRecPtr infoRec
+);
+
+extern _X_EXPORT RegionPtr
+XAABitBlt(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ void (*doBitBlt)(DrawablePtr, DrawablePtr, GCPtr, RegionPtr, DDXPointPtr),
+ unsigned long bitPlane
+);
+
+extern _X_EXPORT void
+XAAScreenToScreenBitBlt(
+ ScrnInfoPtr pScrn,
+ int nbox,
+ DDXPointPtr pptSrc,
+ BoxPtr pbox,
+ int xdir,
+ int ydir,
+ int alu,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAADoBitBlt(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc
+);
+
+extern _X_EXPORT void
+XAADoImageWrite(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc
+);
+
+extern _X_EXPORT void
+XAADoImageRead(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GC *pGC,
+ RegionPtr prgnDst,
+ DDXPointPtr pptSrc
+);
+
+extern _X_EXPORT void
+XAACopyWindow(
+ WindowPtr pWin,
+ DDXPointRec ptOldOrg,
+ RegionPtr prgnSrc
+);
+
+
+extern _X_EXPORT RegionPtr
+XAACopyArea(
+ DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GC *pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty
+);
+
+extern _X_EXPORT void
+XAAValidateCopyArea(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidatePutImage(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidateCopyPlane(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidatePushPixels(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidateFillSpans(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidatePolyGlyphBlt(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidateImageGlyphBlt(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+extern _X_EXPORT void
+XAAValidatePolylines(
+ GCPtr pGC,
+ unsigned long changes,
+ DrawablePtr pDraw
+);
+
+
+extern _X_EXPORT RegionPtr
+XAACopyPlaneColorExpansion(
+ DrawablePtr pSrc,
+ DrawablePtr pDst,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long bitPlane
+);
+
+
+extern _X_EXPORT void
+XAAPushPixelsSolidColorExpansion(
+ GCPtr pGC,
+ PixmapPtr pBitMap,
+ DrawablePtr pDrawable,
+ int dx,
+ int dy,
+ int xOrg,
+ int yOrg
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpandMSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpand3MSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpandMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpand3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpandLSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpand3LSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpandLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapColorExpand3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpandMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpand3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpandMSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpand3MSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpandLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpand3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpandLSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapScanlineColorExpand3LSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int skipleft,
+ int fg, int bg,
+ int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAWritePixmap (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+);
+
+extern _X_EXPORT void
+XAAWritePixmapScanline (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int rop,
+ unsigned int planemask,
+ int transparency_color,
+ int bpp, int depth
+);
+
+typedef void (*ClipAndRenderRectsFunc)(GCPtr, int, BoxPtr, int, int);
+
+
+extern _X_EXPORT void
+XAAClipAndRenderRects(
+ GCPtr pGC,
+ ClipAndRenderRectsFunc func,
+ int nrectFill,
+ xRectangle *prectInit,
+ int xorg, int yorg
+);
+
+
+typedef void (*ClipAndRenderSpansFunc)(GCPtr, int, DDXPointPtr, int*,
+ int, int, int);
+
+extern _X_EXPORT void
+XAAClipAndRenderSpans(
+ GCPtr pGC,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int nspans,
+ int fSorted,
+ ClipAndRenderSpansFunc func,
+ int xorg,
+ int yorg
+);
+
+
+extern _X_EXPORT void
+XAAFillSolidRects(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox
+);
+
+extern _X_EXPORT void
+XAAFillMono8x8PatternRects(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1,
+ int xorg, int yorg
+);
+
+extern _X_EXPORT void
+XAAFillMono8x8PatternRectsScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int pat0, int pat1,
+ int xorg, int yorg
+);
+
+
+extern _X_EXPORT void
+XAAFillColor8x8PatternRectsScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache
+);
+
+extern _X_EXPORT void
+XAAFillColor8x8PatternRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorigin, int yorigin,
+ XAACacheInfoPtr pCache
+);
+
+extern _X_EXPORT void
+XAAFillCacheBltRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ XAACacheInfoPtr pCache
+);
+
+extern _X_EXPORT void
+XAAFillCacheExpandRects(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillImageWriteRects(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAPolyFillRect(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int nrectFill,
+ xRectangle *prectInit
+);
+
+
+extern _X_EXPORT void
+XAATEGlyphRendererMSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRenderer3MSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRendererMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRenderer3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRendererLSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+
+extern _X_EXPORT void
+XAATEGlyphRenderer3LSBFirstFixedBase (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRendererLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRenderer3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+
+extern _X_EXPORT void
+XAATEGlyphRendererScanlineMSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRendererScanline3MSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRendererScanlineLSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+extern _X_EXPORT void
+XAATEGlyphRendererScanline3LSBFirst (
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h, int skipleft, int startline,
+ unsigned int **glyphs, int glyphWidth,
+ int fg, int bg, int rop, unsigned planemask
+);
+
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirstFixedBase[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncMSBFirst[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirstFixedBase[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern _X_EXPORT CARD32 *(*XAAGlyphScanlineFuncLSBFirst[32])(
+ CARD32 *base, unsigned int **glyphp, int line, int nglyph, int width
+);
+
+extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirstFixedBase(void);
+extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncMSBFirst(void);
+extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirstFixedBase(void);
+extern _X_EXPORT GlyphScanlineFuncPtr *XAAGetGlyphScanlineFuncLSBFirst(void);
+
+extern _X_EXPORT void
+XAAFillColorExpandRectsLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRects3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRectsLSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRects3LSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRectsMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRects3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRectsMSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandRects3MSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandRectsLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandRects3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandRectsMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandRects3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int nBox,
+ BoxPtr pBox,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpansLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpans3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpansLSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpans3LSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpansMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpans3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpansMSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillColorExpandSpans3MSBFirstFixedBase(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandSpansLSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandSpans3LSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAPutImage(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int depth,
+ int x,
+ int y,
+ int w,
+ int h,
+ int leftPad,
+ int format,
+ char *pImage
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandSpansMSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillScanlineColorExpandSpans3MSBFirst(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirstFixedBase[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncMSBFirst[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirstFixedBase[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern _X_EXPORT CARD32 *(*XAAStippleScanlineFuncLSBFirst[6])(
+ CARD32* base, CARD32* src, int offset, int width, int dwords
+);
+
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncMSBFirst(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFuncLSBFirst(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3MSBFirst(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirstFixedBase(void);
+extern _X_EXPORT StippleScanlineProcPtr *XAAGetStippleScanlineFunc3LSBFirst(void);
+
+extern _X_EXPORT int
+XAAPolyText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+extern _X_EXPORT int
+XAAPolyText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+extern _X_EXPORT void
+XAAImageText8TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+extern _X_EXPORT void
+XAAImageText16TEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+extern _X_EXPORT void
+XAAImageGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+extern _X_EXPORT void
+XAAPolyGlyphBltTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+
+extern _X_EXPORT int
+XAAPolyText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+extern _X_EXPORT int
+XAAPolyText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+extern _X_EXPORT void
+XAAImageText8NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ char *chars
+);
+
+extern _X_EXPORT void
+XAAImageText16NonTEColorExpansion(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int x, int y,
+ int count,
+ unsigned short *chars
+);
+
+extern _X_EXPORT void
+XAAImageGlyphBltNonTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+extern _X_EXPORT void
+XAAPolyGlyphBltNonTEColorExpansion(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int xInit, int yInit,
+ unsigned int nglyph,
+ CharInfoPtr *ppci,
+ pointer pglyphBase
+);
+
+
+extern _X_EXPORT void XAANonTEGlyphRenderer(
+ ScrnInfoPtr pScrn,
+ int x, int y, int n,
+ NonTEGlyphPtr glyphs,
+ BoxPtr pbox,
+ int fg, int rop,
+ unsigned int planemask
+);
+
+extern _X_EXPORT void
+XAAFillSolidSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted
+);
+
+extern _X_EXPORT void
+XAAFillMono8x8PatternSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int patx, int paty,
+ int xorg, int yorg
+);
+
+extern _X_EXPORT void
+XAAFillMono8x8PatternSpansScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ int patx, int paty,
+ int xorg, int yorg
+);
+
+extern _X_EXPORT void
+XAAFillColor8x8PatternSpansScreenOrigin(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr,
+ int xorigin, int yorigin
+);
+
+extern _X_EXPORT void
+XAAFillColor8x8PatternSpans(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth, int fSorted,
+ XAACacheInfoPtr,
+ int xorigin, int yorigin
+);
+
+extern _X_EXPORT void
+XAAFillCacheBltSpans(
+ ScrnInfoPtr pScrn,
+ int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr points,
+ int *widths,
+ int fSorted,
+ XAACacheInfoPtr pCache,
+ int xorg, int yorg
+);
+
+extern _X_EXPORT void
+XAAFillCacheExpandSpans(
+ ScrnInfoPtr pScrn,
+ int fg, int bg, int rop,
+ unsigned int planemask,
+ int n,
+ DDXPointPtr ppt,
+ int *pwidth,
+ int fSorted,
+ int xorg, int yorg,
+ PixmapPtr pPix
+);
+
+extern _X_EXPORT void
+XAAFillSpans(
+ DrawablePtr pDrawable,
+ GC *pGC,
+ int nInit,
+ DDXPointPtr pptInit,
+ int *pwidth,
+ int fSorted
+);
+
+
+extern _X_EXPORT void
+XAAInitPixmapCache(
+ ScreenPtr pScreen,
+ RegionPtr areas,
+ pointer data
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+);
+
+extern _X_EXPORT void
+XAAWriteBitmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int fg, int bg
+);
+
+extern _X_EXPORT void
+XAAWritePixmapToCache(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+);
+
+extern _X_EXPORT void
+XAAWritePixmapToCacheLinear(
+ ScrnInfoPtr pScrn,
+ int x, int y, int w, int h,
+ unsigned char *src,
+ int srcwidth,
+ int bpp, int depth
+);
+
+extern _X_EXPORT void
+XAASolidHorVertLineAsRects(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+);
+
+extern _X_EXPORT void
+XAASolidHorVertLineAsTwoPoint(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+);
+
+extern _X_EXPORT void
+XAASolidHorVertLineAsBresenham(
+ ScrnInfoPtr pScrn,
+ int x, int y, int len, int dir
+);
+
+
+extern _X_EXPORT void
+XAAPolyRectangleThinSolid(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nRectsInit,
+ xRectangle *pRectsInit
+);
+
+
+extern _X_EXPORT void
+XAAPolylinesWideSolid (
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pPts
+);
+
+extern _X_EXPORT void
+XAAFillPolygonSolid(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+);
+
+extern _X_EXPORT void
+XAAFillPolygonStippled(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+);
+
+
+extern _X_EXPORT void
+XAAFillPolygonTiled(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int shape,
+ int mode,
+ int count,
+ DDXPointPtr ptsIn
+);
+
+
+extern _X_EXPORT int
+XAAIsEasyPolygon(
+ DDXPointPtr ptsIn,
+ int count,
+ BoxPtr extents,
+ int origin,
+ DDXPointPtr *topPoint,
+ int *topY, int *bottomY,
+ int shape
+);
+
+extern _X_EXPORT void
+XAAFillPolygonHelper(
+ ScrnInfoPtr pScrn,
+ DDXPointPtr ptsIn,
+ int count,
+ DDXPointPtr topPoint,
+ int y,
+ int maxy,
+ int origin,
+ RectFuncPtr RectFunc,
+ TrapFuncPtr TrapFunc,
+ int xorg,
+ int yorg,
+ XAACacheInfoPtr pCache
+);
+
+extern _X_EXPORT void
+XAAPolySegment(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+);
+
+extern _X_EXPORT void
+XAAPolyLines(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+);
+
+extern _X_EXPORT void
+XAAPolySegmentDashed(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nseg,
+ xSegment *pSeg
+);
+
+extern _X_EXPORT void
+XAAPolyLinesDashed(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode,
+ int npt,
+ DDXPointPtr pptInit
+);
+
+
+extern _X_EXPORT void
+XAAWriteMono8x8PatternToCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache);
+
+extern _X_EXPORT void
+XAAWriteColor8x8PatternToCache(
+ ScrnInfoPtr pScrn,
+ PixmapPtr pPix,
+ XAACacheInfoPtr pCache
+);
+
+extern _X_EXPORT void
+XAARotateMonoPattern(
+ int *pat0, int *pat1,
+ int xoffset, int yoffset,
+ Bool msbfirst
+);
+
+extern _X_EXPORT void XAAComputeDash(GCPtr pGC);
+
+extern _X_EXPORT void XAAMoveDWORDS_FixedBase(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords
+);
+
+extern _X_EXPORT void XAAMoveDWORDS_FixedSrc(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords
+);
+
+extern _X_EXPORT void XAAMoveDWORDS(
+ register CARD32* dest,
+ register CARD32* src,
+ register int dwords
+);
+
+extern _X_EXPORT int
+XAAGetRectClipBoxes(
+ GCPtr pGC,
+ BoxPtr pboxClippedBase,
+ int nrectFill,
+ xRectangle *prectInit
+);
+
+extern _X_EXPORT void
+XAASetupOverlay8_32Planar(ScreenPtr);
+
+extern _X_EXPORT void
+XAAPolyFillArcSolid(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs);
+
+extern _X_EXPORT XAACacheInfoPtr
+XAACacheTile(ScrnInfoPtr Scrn, PixmapPtr pPix);
+
+extern _X_EXPORT XAACacheInfoPtr
+XAACacheMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
+
+extern _X_EXPORT XAACacheInfoPtr
+XAACachePlanarMonoStipple(ScrnInfoPtr Scrn, PixmapPtr pPix);
+
+typedef XAACacheInfoPtr (*XAACachePlanarMonoStippleProc)(ScrnInfoPtr, PixmapPtr);
+extern _X_EXPORT XAACachePlanarMonoStippleProc XAAGetCachePlanarMonoStipple(void);
+
+extern _X_EXPORT XAACacheInfoPtr
+XAACacheStipple(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
+
+extern _X_EXPORT XAACacheInfoPtr
+XAACacheMono8x8Pattern(ScrnInfoPtr Scrn, int pat0, int pat1);
+
+extern _X_EXPORT XAACacheInfoPtr
+XAACacheColor8x8Pattern(ScrnInfoPtr Scrn, PixmapPtr pPix, int fg, int bg);
+
+extern _X_EXPORT void
+XAATileCache(ScrnInfoPtr pScrn, XAACacheInfoPtr pCache, int w, int h);
+
+extern _X_EXPORT void XAAClosePixmapCache(ScreenPtr pScreen);
+void XAAInvalidatePixmapCache(ScreenPtr pScreen);
+
+extern _X_EXPORT Bool XAACheckStippleReducibility(PixmapPtr pPixmap);
+extern _X_EXPORT Bool XAACheckTileReducibility(PixmapPtr pPixmap, Bool checkMono);
+
+extern _X_EXPORT int XAAStippledFillChooser(GCPtr pGC);
+extern _X_EXPORT int XAAOpaqueStippledFillChooser(GCPtr pGC);
+extern _X_EXPORT int XAATiledFillChooser(GCPtr pGC);
+
+extern _X_EXPORT void XAAMoveInOffscreenPixmaps(ScreenPtr pScreen);
+extern _X_EXPORT void XAAMoveOutOffscreenPixmaps(ScreenPtr pScreen);
+extern _X_EXPORT void XAARemoveAreaCallback(FBAreaPtr area);
+extern _X_EXPORT void XAAMoveOutOffscreenPixmap(PixmapPtr pPix);
+extern _X_EXPORT Bool XAAInitStateWrap(ScreenPtr pScreen, XAAInfoRecPtr infoRec);
+
+extern _X_EXPORT void
+XAAComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+
+extern _X_EXPORT Bool
+XAADoComposite (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pMask,
+ PicturePtr pDst,
+ INT16 xSrc,
+ INT16 ySrc,
+ INT16 xMask,
+ INT16 yMask,
+ INT16 xDst,
+ INT16 yDst,
+ CARD16 width,
+ CARD16 height);
+
+
+extern _X_EXPORT void
+XAAGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
+extern _X_EXPORT Bool
+XAADoGlyphs (CARD8 op,
+ PicturePtr pSrc,
+ PicturePtr pDst,
+ PictFormatPtr maskFormat,
+ INT16 xSrc,
+ INT16 ySrc,
+ int nlist,
+ GlyphListPtr list,
+ GlyphPtr *glyphs);
+
+
+
+/* helpers */
+extern _X_EXPORT void
+XAA_888_plus_PICT_a8_to_8888 (
+ CARD32 color,
+ CARD8 *alphaPtr, /* in bytes */
+ int alphaPitch,
+ CARD32 *dstPtr,
+ int dstPitch, /* in dwords */
+ int width,
+ int height
+);
+
+extern _X_EXPORT Bool
+XAAGetRGBAFromPixel(
+ CARD32 pixel,
+ CARD16 *red,
+ CARD16 *green,
+ CARD16 *blue,
+ CARD16 *alpha,
+ CARD32 format
+);
+
+
+extern _X_EXPORT Bool
+XAAGetPixelFromRGBA (
+ CARD32 *pixel,
+ CARD16 red,
+ CARD16 green,
+ CARD16 blue,
+ CARD16 alpha,
+ CARD32 format
+);
+
+/* XXX should be static */
+extern _X_EXPORT GCOps XAAFallbackOps;
+extern _X_EXPORT GCOps *XAAGetFallbackOps(void);
+extern _X_EXPORT GCFuncs XAAGCFuncs;
+extern _X_EXPORT DevPrivateKey XAAGetScreenKey(void);
+extern _X_EXPORT DevPrivateKey XAAGetGCKey(void);
+extern _X_EXPORT DevPrivateKey XAAGetPixmapKey(void);
+
+extern _X_EXPORT unsigned int XAAShiftMasks[32];
+
+extern _X_EXPORT unsigned int byte_expand3[256], byte_reversed_expand3[256];
+
+extern _X_EXPORT CARD32 XAAReverseBitOrder(CARD32 data);
+
+#define GET_XAASCREENPTR_FROM_SCREEN(pScreen)\
+ dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey())
+
+#define GET_XAASCREENPTR_FROM_GC(pGC)\
+ dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey())
+
+#define GET_XAASCREENPTR_FROM_DRAWABLE(pDraw)\
+ dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey())
+
+#define GET_XAAINFORECPTR_FROM_SCREEN(pScreen)\
+((XAAScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define GET_XAAINFORECPTR_FROM_GC(pGC)\
+((XAAScreenPtr)dixLookupPrivate(&(pGC)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define GET_XAAINFORECPTR_FROM_DRAWABLE(pDraw)\
+((XAAScreenPtr)dixLookupPrivate(&(pDraw)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn)\
+((XAAScreenPtr)dixLookupPrivate(&(pScrn)->pScreen->devPrivates, XAAGetScreenKey()))->AccelInfoRec
+
+#define XAA_GET_PIXMAP_PRIVATE(pix)\
+ (XAAPixmapPtr)dixLookupPrivate(&(pix)->devPrivates, XAAGetPixmapKey())
+
+#define CHECK_RGB_EQUAL(c) (!((((c) >> 8) ^ (c)) & 0xffff))
+
+#define CHECK_FG(pGC, flags) \
+ (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->fgPixel))
+
+#define CHECK_BG(pGC, flags) \
+ (!(flags & RGB_EQUAL) || CHECK_RGB_EQUAL(pGC->bgPixel))
+
+#define CHECK_ROP(pGC, flags) \
+ (!(flags & GXCOPY_ONLY) || (pGC->alu == GXcopy))
+
+#define CHECK_ROPSRC(pGC, flags) \
+ (!(flags & ROP_NEEDS_SOURCE) || ((pGC->alu != GXclear) && \
+ (pGC->alu != GXnoop) && (pGC->alu != GXinvert) && \
+ (pGC->alu != GXset)))
+
+#define CHECK_PLANEMASK(pGC, flags) \
+ (!(flags & NO_PLANEMASK) || \
+ ((pGC->planemask & infoRec->FullPlanemasks[pGC->depth - 1]) == \
+ infoRec->FullPlanemasks[pGC->depth - 1]))
+
+#define CHECK_COLORS(pGC, flags) \
+ (!(flags & RGB_EQUAL) || \
+ (CHECK_RGB_EQUAL(pGC->fgPixel) && CHECK_RGB_EQUAL(pGC->bgPixel)))
+
+#define CHECK_NO_GXCOPY(pGC, flags) \
+ ((pGC->alu != GXcopy) || !(flags & NO_GXCOPY) || \
+ ((pGC->planemask & infoRec->FullPlanemask) != infoRec->FullPlanemask))
+
+#define IS_OFFSCREEN_PIXMAP(pPix)\
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->offscreenArea)
+
+#define PIXMAP_IS_SHARED(pPix)\
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & SHARED_PIXMAP)
+
+#define OFFSCREEN_PIXMAP_LOCKED(pPix)\
+ ((XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pPix)))->flags & LOCKED_PIXMAP)
+
+#define XAA_DEPTH_BUG(pGC) \
+ ((pGC->depth == 32) && (pGC->bgPixel == 0xffffffff))
+
+#define DELIST_OFFSCREEN_PIXMAP(pPix) { \
+ PixmapLinkPtr _pLink, _prev; \
+ _pLink = infoRec->OffscreenPixmaps; \
+ _prev = NULL; \
+ while(_pLink) { \
+ if(_pLink->pPix == pPix) { \
+ if(_prev) _prev->next = _pLink->next; \
+ else infoRec->OffscreenPixmaps = _pLink->next; \
+ free(_pLink); \
+ break; \
+ } \
+ _prev = _pLink; \
+ _pLink = _pLink->next; \
+ }}
+
+
+#define SWAP_BITS_IN_BYTES(v) \
+ (((0x01010101 & (v)) << 7) | ((0x02020202 & (v)) << 5) | \
+ ((0x04040404 & (v)) << 3) | ((0x08080808 & (v)) << 1) | \
+ ((0x10101010 & (v)) >> 1) | ((0x20202020 & (v)) >> 3) | \
+ ((0x40404040 & (v)) >> 5) | ((0x80808080 & (v)) >> 7))
+
+/*
+ * Moved XAAPixmapCachePrivate here from xaaPCache.c, since driver
+ * replacements for CacheMonoStipple need access to it
+ */
+
+typedef struct {
+ int Num512x512;
+ int Current512;
+ XAACacheInfoPtr Info512;
+ int Num256x256;
+ int Current256;
+ XAACacheInfoPtr Info256;
+ int Num128x128;
+ int Current128;
+ XAACacheInfoPtr Info128;
+ int NumMono;
+ int CurrentMono;
+ XAACacheInfoPtr InfoMono;
+ int NumColor;
+ int CurrentColor;
+ XAACacheInfoPtr InfoColor;
+ int NumPartial;
+ int CurrentPartial;
+ XAACacheInfoPtr InfoPartial;
+ DDXPointRec MonoOffsets[64];
+ DDXPointRec ColorOffsets[64];
+} XAAPixmapCachePrivate, *XAAPixmapCachePrivatePtr;
+
+
+#endif /* _XAALOCAL_H */