--- files/092_Xserver_sunffb_xaa_extension.diff- 2005-01-25 13:49:56.000000000 +0000 +++ files/092_Xserver_sunffb_xaa_extension.diff 2005-01-25 13:49:56.000000000 +0000 @@ -0,0 +1,2509 @@ +$Id$ + +Add RENDER and X Acceleration Architecture (XAA) support to Sun FFB driver, +and use FB framebuffer layer instead of MFB and CFB. + +This patch by David S. Miller. +Forward-port by Fabio M. Di Nitto. + +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c 2004-04-23 21:48:16.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c 2004-11-16 14:01:53.530947352 +0100 +@@ -30,22 +30,9 @@ + #include "pixmapstr.h" + #include "regionstr.h" + #include "mistruct.h" +-#include "fontstruct.h" +-#include "dixfontstr.h" +-#define PSZ 8 +-#include "cfb.h" +-#undef PSZ +-#include "cfb32.h" +-#include "mibstore.h" +-#include "mifillarc.h" +-#include "miwideline.h" + #include "miline.h" +-#include "fastblt.h" +-#include "mergerop.h" +-#include "migc.h" +-#include "mi.h" +- +-#include "cfb8_32wid.h" ++#include "fb.h" ++#include "xaa.h" + + #include "ffb.h" + #include "ffb_fifo.h" +@@ -69,635 +56,6 @@ + /*XXX*/ { 0x00c0, 0x0a00, 0x04, 0x08, 0x08, 0x50 }, /* Portrait: 1280 x 2048 XXX */ + }; + +-static Bool +-CreatorCreateWindow (WindowPtr pWin) +-{ +- ScreenPtr pScreen = pWin->drawable.pScreen; +- FFBPtr pFfb = GET_FFB_FROM_SCREEN(pScreen); +- CreatorPrivWinPtr pFfbPrivWin; +- unsigned int fbc; +- int depth = (pWin->drawable.depth == 8) ? 8 : 24; +- int i, visual, visclass; +- +- if (depth == 8) { +- if (!cfbCreateWindow (pWin)) +- return FALSE; +- } else { +- if (!cfb32CreateWindow (pWin)) +- return FALSE; +- } +- +- pFfbPrivWin = xalloc(sizeof(CreatorPrivWinRec)); +- if (!pFfbPrivWin) +- return FALSE; +- +- fbc = FFB_FBC_WB_A | FFB_FBC_WM_COMBINED | FFB_FBC_RB_A; +- fbc |= FFB_FBC_WE_FORCEON; +- fbc |= FFB_FBC_SB_BOTH; +- fbc |= FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF; +- if (depth == 8) +- fbc |= (FFB_FBC_RE_MASK | FFB_FBC_GE_OFF | FFB_FBC_BE_OFF); +- else +- fbc |= FFB_FBC_RGBE_MASK; +- fbc |= FFB_FBC_XE_ON; +- pFfbPrivWin->fbc_base = fbc; +- +- visual = wVisual(pWin); +- visclass = 0; +- for (i = 0; i < pScreen->numVisuals; i++) { +- if (pScreen->visuals[i].vid == visual) { +- visclass = pScreen->visuals[i].class; +- break; +- } +- } +- +- pFfbPrivWin->wid = FFBWidAlloc(pFfb, visclass, wColormap(pWin), TRUE); +- if (pFfbPrivWin->wid == (unsigned int) -1) { +- xfree(pFfbPrivWin); +- return FALSE; +- } +- FFBLOG(("CreatorCreateWindow: pWin %p depth %d wid %x fbc_base %x\n", +- pWin, depth, pFfbPrivWin->wid, pFfbPrivWin->fbc_base)); +- +- pFfbPrivWin->Stipple = NULL; +- CreatorSetWindowPrivate(pWin, pFfbPrivWin); +- +- return TRUE; +-} +- +-static Bool +-CreatorDestroyWindow (WindowPtr pWin) +-{ +- FFBPtr pFfb = GET_FFB_FROM_SCREEN(pWin->drawable.pScreen); +- CreatorPrivWinPtr pFfbPrivWin; +- int depth = (pWin->drawable.depth == 8) ? 8 : 24; +- +- FFBLOG(("CreatorDestroyWindow: pWin %p depth %d\n", pWin, depth)); +- pFfbPrivWin = CreatorGetWindowPrivate(pWin); +- if (pFfbPrivWin->Stipple) +- xfree(pFfbPrivWin->Stipple); +- FFBWidFree(pFfb, pFfbPrivWin->wid); +- xfree(pFfbPrivWin); +- +- if (depth == 8) +- return cfbDestroyWindow (pWin); +- else +- return cfb32DestroyWindow (pWin); +-} +- +-extern CreatorStipplePtr FFB_tmpStipple; +- +-static int +-CreatorChangeWindowAttributes (WindowPtr pWin, unsigned long mask) +-{ +- FFBPtr pFfb = GET_FFB_FROM_SCREEN(pWin->drawable.pScreen); +- CreatorPrivWinPtr pFfbPrivWin; +- CreatorStipplePtr stipple; +- Mask index; +- WindowPtr pBgWin; +- register cfbPrivWin *pPrivWin; +- int width, depth; +- +- FFBLOG(("CreatorChangeWindowAttributes: WIN(%p) mask(%08x)\n", pWin, mask)); +- pPrivWin = (cfbPrivWin *)(pWin->devPrivates[cfbWindowPrivateIndex].ptr); +- pFfbPrivWin = CreatorGetWindowPrivate(pWin); +- depth = pWin->drawable.depth; +- +- /* +- * When background state changes from ParentRelative and +- * we had previously rotated the fast border pixmap to match +- * the parent relative origin, rerotate to match window +- */ +- if (mask & (CWBackPixmap | CWBackPixel) && +- pWin->backgroundState != ParentRelative && +- pPrivWin->fastBorder && +- (pPrivWin->oldRotate.x != pWin->drawable.x || +- pPrivWin->oldRotate.y != pWin->drawable.y)) { +- if (depth == 8) { +- cfbXRotatePixmap(pPrivWin->pRotatedBorder, +- pWin->drawable.x - pPrivWin->oldRotate.x); +- cfbYRotatePixmap(pPrivWin->pRotatedBorder, +- pWin->drawable.y - pPrivWin->oldRotate.y); +- } else { +- cfb32XRotatePixmap(pPrivWin->pRotatedBorder, +- pWin->drawable.x - pPrivWin->oldRotate.x); +- cfb32YRotatePixmap(pPrivWin->pRotatedBorder, +- pWin->drawable.y - pPrivWin->oldRotate.y); +- } +- pPrivWin->oldRotate.x = pWin->drawable.x; +- pPrivWin->oldRotate.y = pWin->drawable.y; +- } +- while (mask) { +- index = lowbit(mask); +- mask &= ~index; +- switch (index) { +- case CWBackPixmap: +- stipple = pFfbPrivWin->Stipple; +- if (pWin->backgroundState == None || +- pWin->backgroundState == ParentRelative) { +- pPrivWin->fastBackground = FALSE; +- if (stipple) { +- xfree (stipple); +- pFfbPrivWin->Stipple = NULL; +- } +- /* Rotate border to match parent origin */ +- if (pWin->backgroundState == ParentRelative && +- pPrivWin->pRotatedBorder) { +- for (pBgWin = pWin->parent; +- pBgWin->backgroundState == ParentRelative; +- pBgWin = pBgWin->parent); +- if (depth == 8) { +- cfbXRotatePixmap(pPrivWin->pRotatedBorder, +- pBgWin->drawable.x - pPrivWin->oldRotate.x); +- cfbYRotatePixmap(pPrivWin->pRotatedBorder, +- pBgWin->drawable.y - pPrivWin->oldRotate.y); +- } else { +- cfb32XRotatePixmap(pPrivWin->pRotatedBorder, +- pBgWin->drawable.x - pPrivWin->oldRotate.x); +- cfb32YRotatePixmap(pPrivWin->pRotatedBorder, +- pBgWin->drawable.y - pPrivWin->oldRotate.y); +- } +- pPrivWin->oldRotate.x = pBgWin->drawable.x; +- pPrivWin->oldRotate.y = pBgWin->drawable.y; +- } +- break; +- } +- if (!stipple) { +- if (!FFB_tmpStipple) +- FFB_tmpStipple = (CreatorStipplePtr) +- xalloc (sizeof *FFB_tmpStipple); +- stipple = FFB_tmpStipple; +- } +- if (stipple) { +- int ph = FFB_FFPARMS(pFfb).pagefill_height; +- +- if (CreatorCheckTile (pWin->background.pixmap, stipple, +- ((DrawablePtr)pWin)->x & 31, +- ((DrawablePtr)pWin)->y & 31, ph)) { +- stipple->alu = GXcopy; +- pPrivWin->fastBackground = FALSE; +- if (stipple == FFB_tmpStipple) { +- pFfbPrivWin->Stipple = stipple; +- FFB_tmpStipple = 0; +- } +- break; +- } +- } +- if ((stipple = pFfbPrivWin->Stipple) != NULL) { +- xfree (stipple); +- pFfbPrivWin->Stipple = NULL; +- } +- if (((width = (pWin->background.pixmap->drawable.width * +- pWin->background.pixmap->drawable.bitsPerPixel)) <= 32) && +- !(width & (width - 1))) { +- if (depth == 8) { +- cfbCopyRotatePixmap(pWin->background.pixmap, +- &pPrivWin->pRotatedBackground, +- pWin->drawable.x, +- pWin->drawable.y); +- } else { +- cfb32CopyRotatePixmap(pWin->background.pixmap, +- &pPrivWin->pRotatedBackground, +- pWin->drawable.x, +- pWin->drawable.y); +- } +- if (pPrivWin->pRotatedBackground) { +- pPrivWin->fastBackground = TRUE; +- pPrivWin->oldRotate.x = pWin->drawable.x; +- pPrivWin->oldRotate.y = pWin->drawable.y; +- } else +- pPrivWin->fastBackground = FALSE; +- break; +- } +- pPrivWin->fastBackground = FALSE; +- break; +- +- case CWBackPixel: +- pPrivWin->fastBackground = FALSE; +- break; +- +- case CWBorderPixmap: +- /* don't bother with accelerator for border tiles (just lazy) */ +- if (((width = (pWin->border.pixmap->drawable.width * +- pWin->border.pixmap->drawable.bitsPerPixel)) <= 32) && +- !(width & (width - 1))) { +- for (pBgWin = pWin; +- pBgWin->backgroundState == ParentRelative; +- pBgWin = pBgWin->parent) +- ; +- if (depth == 8) { +- cfbCopyRotatePixmap(pWin->border.pixmap, +- &pPrivWin->pRotatedBorder, +- pBgWin->drawable.x, +- pBgWin->drawable.y); +- } else { +- cfb32CopyRotatePixmap(pWin->border.pixmap, +- &pPrivWin->pRotatedBorder, +- pBgWin->drawable.x, +- pBgWin->drawable.y); +- } +- if (pPrivWin->pRotatedBorder) { +- pPrivWin->fastBorder = TRUE; +- pPrivWin->oldRotate.x = pBgWin->drawable.x; +- pPrivWin->oldRotate.y = pBgWin->drawable.y; +- } else +- pPrivWin->fastBorder = FALSE; +- } else +- pPrivWin->fastBorder = FALSE; +- break; +- +- case CWBorderPixel: +- pPrivWin->fastBorder = FALSE; +- break; +- } +- } +- return (TRUE); +-} +- +-static void +-CreatorPaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +-{ +- FFBPtr pFfb = GET_FFB_FROM_SCREEN (pWin->drawable.pScreen); +- ffb_fbcPtr ffb = pFfb->regs; +- register cfbPrivWin *pPrivWin; +- CreatorPrivWinPtr pFfbPrivWin; +- CreatorStipplePtr stipple; +- WindowPtr pBgWin; +- int depth = pWin->drawable.depth; +- +- if (pFfb->vtSema) +- return; +- +- FFBLOG(("CreatorPaintWindow: WIN(%p) what(%d)\n", pWin, what)); +- pPrivWin = cfbGetWindowPrivate(pWin); +- pFfbPrivWin = CreatorGetWindowPrivate(pWin); +- switch (what) { +- case PW_BACKGROUND: +- stipple = pFfbPrivWin->Stipple; +- switch (pWin->backgroundState) { +- case None: +- return; +- case ParentRelative: +- do { +- pWin = pWin->parent; +- } while (pWin->backgroundState == ParentRelative); +- (*pWin->drawable.pScreen->PaintWindowBackground)(pWin, pRegion, what); +- return; +- case BackgroundPixmap: +- if (stipple) { +- CreatorFillBoxStipple ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- stipple); +- return; +- } +- FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); +- FFBWait(pFfb, ffb); +- if (pPrivWin->fastBackground) { +- if (depth == 8) { +- cfbFillBoxTile32 ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pPrivWin->pRotatedBackground); +- } else { +- cfb32FillBoxTile32 ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pPrivWin->pRotatedBackground); +- } +- } else { +- if (depth == 8) { +- cfbFillBoxTileOdd ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pWin->background.pixmap, +- (int) pWin->drawable.x, +- (int) pWin->drawable.y); +- } else { +- cfb32FillBoxTileOdd ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pWin->background.pixmap, +- (int) pWin->drawable.x, +- (int) pWin->drawable.y); +- } +- } +- return; +- case BackgroundPixel: +- CreatorFillBoxSolid ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pWin->background.pixel); +- return; +- } +- break; +- case PW_BORDER: +- if (pWin->borderIsPixel) { +- CreatorFillBoxSolid ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pWin->border.pixel); +- return; +- } +- FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); +- FFBWait(pFfb, ffb); +- if (pPrivWin->fastBorder) { +- if (depth == 8) { +- cfbFillBoxTile32 ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pPrivWin->pRotatedBorder); +- } else { +- cfb32FillBoxTile32 ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pPrivWin->pRotatedBorder); +- } +- } else { +- for (pBgWin = pWin; +- pBgWin->backgroundState == ParentRelative; +- pBgWin = pBgWin->parent) +- ; +- +- if (depth == 8) { +- cfbFillBoxTileOdd ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pWin->border.pixmap, +- (int) pBgWin->drawable.x, +- (int) pBgWin->drawable.y); +- } else { +- cfb32FillBoxTileOdd ((DrawablePtr)pWin, +- (int)REGION_NUM_RECTS(pRegion), +- REGION_RECTS(pRegion), +- pWin->border.pixmap, +- (int) pBgWin->drawable.x, +- (int) pBgWin->drawable.y); +- } +- } +- return; +- } +-} +- +-static void +-CreatorCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +-{ +- ScreenPtr pScreen = pWin->drawable.pScreen; +- FFBPtr pFfb = GET_FFB_FROM_SCREEN (pScreen); +- DDXPointPtr pptSrc; +- DDXPointPtr ppt; +- RegionRec rgnDst; +- BoxPtr pbox; +- int dx, dy; +- int i, nbox; +- WindowPtr pwinRoot; +- +- if (pFfb->vtSema) +- return; +- +- FFBLOG(("CreatorCopyWindow: WIN(%p)\n", pWin)); +- +- 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(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) +- return; +- +- ppt = pptSrc; +- for (i = nbox; --i >= 0; ppt++, pbox++) { +- ppt->x = pbox->x1 + dx; +- ppt->y = pbox->y1 + dy; +- } +- +- /* XXX Optimize this later to only gcopy/vcopy the 8bpp+WID plane +- * XXX when possible. -DaveM +- */ +- +- pwinRoot = WindowTable[pScreen->myNum]; +- +- if (!pFfb->disable_vscroll && (!dx && dy)) { +- FFBPtr pFfb = GET_FFB_FROM_SCREEN(pScreen); +- +- FFB_ATTR_VSCROLL_WINCOPY(pFfb); +- CreatorDoVertBitblt ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, +- GXcopy, &rgnDst, pptSrc, ~0L); +- } else { +- FFBPtr pFfb = GET_FFB_FROM_SCREEN(pScreen); +- ffb_fbcPtr ffb = pFfb->regs; +- +- FFB_ATTR_SFB_VAR_WINCOPY(pFfb); +- FFBWait(pFfb, ffb); +- CreatorDoBitblt ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, +- GXcopy, &rgnDst, pptSrc, ~0L); +- } +- DEALLOCATE_LOCAL(pptSrc); +- REGION_UNINIT(pScreen, &rgnDst); +-} +- +-static void +-CreatorSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, WindowPtr pWin) +-{ +- ScreenPtr pScreen = pPixmap->drawable.pScreen; +- FFBPtr pFfb = GET_FFB_FROM_SCREEN(pScreen); +- cfb8_32WidScreenPtr pScreenPriv = +- CFB8_32WID_GET_SCREEN_PRIVATE(pScreen); +- ffb_fbcPtr ffb = pFfb->regs; +- register DDXPointPtr pPt; +- DDXPointPtr pPtsInit; +- register BoxPtr pBox; +- register int i; +- PixmapPtr pScrPix; +- +- if (pFfb->vtSema) +- return; +- +- FFBLOG(("CreatorSaveAreas: WIN(%p)\n", pWin)); +- i = REGION_NUM_RECTS(prgnSave); +- pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i * sizeof(DDXPointRec)); +- if (!pPtsInit) +- return; +- +- pBox = REGION_RECTS(prgnSave); +- pPt = pPtsInit; +- while (--i >= 0) { +- pPt->x = pBox->x1 + xorg; +- pPt->y = pBox->y1 + yorg; +- pPt++; +- pBox++; +- } +- +- if (pWin->drawable.bitsPerPixel == 8) +- pScrPix = (PixmapPtr) pScreenPriv->pix8; +- else +- pScrPix = (PixmapPtr) pScreenPriv->pix32; +- +- /* SRC is the framebuffer, DST is a pixmap. The SFB_VAR attributes may +- * seem silly, but they are needed even in this case to handle +- * double-buffered windows properly. +- */ +- FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); +- FFBWait(pFfb, ffb); +- CreatorDoBitblt((DrawablePtr) pScrPix, (DrawablePtr)pPixmap, +- GXcopy, prgnSave, pPtsInit, ~0L); +- +- DEALLOCATE_LOCAL (pPtsInit); +-} +- +-static void +-CreatorRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int yorg, WindowPtr pWin) +-{ +- FFBPtr pFfb; +- ffb_fbcPtr ffb; +- register DDXPointPtr pPt; +- DDXPointPtr pPtsInit; +- register BoxPtr pBox; +- register int i; +- ScreenPtr pScreen = pPixmap->drawable.pScreen; +- cfb8_32WidScreenPtr pScreenPriv = +- CFB8_32WID_GET_SCREEN_PRIVATE(pScreen); +- PixmapPtr pScrPix; +- +- pFfb = GET_FFB_FROM_SCREEN(pScreen); +- if (pFfb->vtSema) +- return; +- +- FFBLOG(("CreatorRestoreAreas: WIN(%p)\n", pWin)); +- i = REGION_NUM_RECTS(prgnRestore); +- pPtsInit = (DDXPointPtr)ALLOCATE_LOCAL(i*sizeof(DDXPointRec)); +- if (!pPtsInit) +- return; +- +- pBox = REGION_RECTS(prgnRestore); +- pPt = pPtsInit; +- while (--i >= 0) { +- pPt->x = pBox->x1 - xorg; +- pPt->y = pBox->y1 - yorg; +- pPt++; +- pBox++; +- } +- +- if (pWin->drawable.bitsPerPixel == 8) +- pScrPix = (PixmapPtr) pScreenPriv->pix8; +- else +- pScrPix = (PixmapPtr) pScreenPriv->pix32; +- +- pFfb = GET_FFB_FROM_SCREEN(pScreen); +- ffb = pFfb->regs; +- +- /* SRC is a pixmap, DST is the framebuffer */ +- FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); +- FFBWait(pFfb, ffb); +- CreatorDoBitblt((DrawablePtr)pPixmap, (DrawablePtr) pScrPix, +- GXcopy, prgnRestore, pPtsInit, ~0L); +- +- DEALLOCATE_LOCAL (pPtsInit); +-} +- +-static void +-CreatorGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planeMask, char* pdstLine) +-{ +- BoxRec box; +- DDXPointRec ptSrc; +- RegionRec rgnDst; +- ScreenPtr pScreen; +- PixmapPtr pPixmap; +- +- FFBLOG(("CreatorGetImage: s[%08x:%08x] wh[%08x:%08x]\n", sx, sy, w, h)); +- if ((w == 0) || (h == 0)) +- return; +- if (pDrawable->bitsPerPixel == 1) { +- mfbGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); +- return; +- } +- pScreen = pDrawable->pScreen; +- /* +- * XFree86 DDX empties the root borderClip when the VT is +- * switched away; this checks for that case +- */ +- if (!cfbDrawableEnabled (pDrawable)) +- return; +- if(format == ZPixmap) { +- FFBPtr pFfb = GET_FFB_FROM_SCREEN (pScreen); +- ffb_fbcPtr ffb = pFfb->regs; +- +- /* We have to have the full planemask. */ +- if (pDrawable->type == DRAWABLE_WINDOW) { +- WindowPtr pWin = (WindowPtr) pDrawable; +- +- FFB_ATTR_SFB_VAR_WIN(pFfb, 0x00ffffff, GXcopy, pWin); +- FFBWait(pFfb, ffb); +- } +- +- if (pDrawable->bitsPerPixel == 8) { +- if((planeMask & 0x000000ff) != 0x000000ff) { +- cfbGetImage(pDrawable, sx, sy, w, h, +- format, planeMask, pdstLine); +- return; +- } +- } else { +- if((planeMask & 0x00ffffff) != 0x00ffffff) { +- cfb32GetImage(pDrawable, sx, sy, w, h, +- format, planeMask, pdstLine); +- return; +- } +- } +- +- /* SRC is the framebuffer, DST is a pixmap */ +- if (pDrawable->type == DRAWABLE_WINDOW && w == 1 && h == 1) { +- /* Benchmarks do this make sure the acceleration hardware +- * has completed all of it's operations, therefore I feel +- * it is not cheating to special case this because if +- * anything it gives the benchmarks more accurate results. +- */ +- if (pDrawable->bitsPerPixel == 32) { +- unsigned char *sfb = (unsigned char *)pFfb->sfb32; +- unsigned int *dstPixel = (unsigned int *)pdstLine; +- unsigned int tmp; +- +- tmp = *((unsigned int *)(sfb + +- ((sy + pDrawable->y) << 13) + +- ((sx + pDrawable->x) << 2))); +- *dstPixel = (tmp & 0x00ffffff); +- } else { +- unsigned char *sfb = (unsigned char *)pFfb->sfb8r; +- unsigned char *dstPixel = (unsigned char *)pdstLine; +- +- *dstPixel = *((unsigned char *)(sfb + +- ((sy + pDrawable->y) << 11) + +- ((sx + pDrawable->x) << 0))); +- } +- return; +- } +- pPixmap = GetScratchPixmapHeader(pScreen, w, h, +- pDrawable->depth, pDrawable->bitsPerPixel, +- PixmapBytePad(w,pDrawable->depth), (pointer)pdstLine); +- if (!pPixmap) +- return; +- ptSrc.x = sx + pDrawable->x; +- ptSrc.y = sy + pDrawable->y; +- box.x1 = 0; +- box.y1 = 0; +- box.x2 = w; +- box.y2 = h; +- REGION_INIT(pScreen, &rgnDst, &box, 1); +- CreatorDoBitblt(pDrawable, (DrawablePtr)pPixmap, GXcopy, &rgnDst, +- &ptSrc, planeMask); +- REGION_UNINIT(pScreen, &rgnDst); +- FreeScratchPixmapHeader(pPixmap); +- } else +- miGetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); +-} +- +-extern void +-CreatorGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, +- int *pwidth, int nspans, char *pchardstStart); +- + void + CreatorVtChange (ScreenPtr pScreen, int enter) + { +@@ -705,7 +63,7 @@ + ffb_fbcPtr ffb = pFfb->regs; + + pFfb->rp_active = 1; +- FFBWait(pFfb, ffb); ++ FFBWait(pFfb, ffb); + pFfb->fifo_cache = -1; + pFfb->fbc_cache = (FFB_FBC_WB_A | FFB_FBC_WM_COMBINED | + FFB_FBC_RB_A | FFB_FBC_SB_BOTH| FFB_FBC_XE_OFF | +@@ -743,8 +101,8 @@ + FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF | FFB_FBC_RGBE_ON); + pFfb->ppc_cache &= ~FFB_PPC_XS_MASK; + pFfb->ppc_cache |= FFB_PPC_XS_WID; +- pFfb->wid_cache = 0xff; +- FFBFifo(pFfb, 8); ++ pFfb->wid_cache = (enter ? pFfb->xaa_wid : 0xff); ++ FFBFifo(pFfb, 11); + ffb->fbc = pFfb->fbc_cache; + ffb->ppc = FFB_PPC_XS_WID; + ffb->wid = pFfb->wid_cache; +@@ -753,7 +111,718 @@ + ffb->cmp = 0x80808080; + ffb->matchab = 0x80808080; + ffb->magnab = 0x80808080; ++ ffb->blendc = (FFB_BLENDC_FORCE_ONE | ++ FFB_BLENDC_DF_ONE_M_A | ++ FFB_BLENDC_SF_A); ++ ffb->blendc1 = 0; ++ ffb->blendc2 = 0; ++ pFfb->rp_active = 1; + FFBWait(pFfb, ffb); ++ ++ if (enter) { ++ pFfb->drawop_cache = FFB_DRAWOP_RECTANGLE; ++ ++ FFBFifo(pFfb, 5); ++ ffb->drawop = pFfb->drawop_cache; ++ FFB_WRITE64(&ffb->by, 0, 0); ++ FFB_WRITE64_2(&ffb->bh, pFfb->psdp->height, pFfb->psdp->width); ++ pFfb->rp_active = 1; ++ FFBWait(pFfb, ffb); ++ ++ SET_SYNC_FLAG(pFfb->pXAAInfo); ++ } ++} ++ ++#ifdef DEBUG_FFB ++FILE *FDEBUG_FD = NULL; ++#endif ++ ++#define FFB_ATTR_SFB_VAR_XAA(__fpriv, __pmask, __alu) \ ++do { unsigned int __ppc = FFB_PPC_ABE_DISABLE | FFB_PPC_APE_DISABLE | FFB_PPC_CS_VAR | FFB_PPC_XS_WID; \ ++ unsigned int __ppc_mask = FFB_PPC_ABE_MASK | FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; \ ++ unsigned int __rop = (FFB_ROP_EDIT_BIT | (__alu))|(FFB_ROP_NEW<<8); \ ++ unsigned int __fbc = (__fpriv)->xaa_fbc; \ ++ unsigned int __wid = (__fpriv)->xaa_wid; \ ++ if (((__fpriv)->ppc_cache & __ppc_mask) != __ppc || \ ++ (__fpriv)->fbc_cache != __fbc || \ ++ (__fpriv)->wid_cache != __wid || \ ++ (__fpriv)->rop_cache != __rop || \ ++ (__fpriv)->pmask_cache != (__pmask)) \ ++ __FFB_Attr_SFB_VAR(__fpriv, __ppc, __ppc_mask, __fbc, \ ++ __wid, __rop, (__pmask)); \ ++} while(0) ++ ++#define FFB_ATTR_VSCROLL_XAA(__fpriv, __pmask) \ ++do { unsigned int __rop = (FFB_ROP_OLD | (FFB_ROP_OLD << 8)); \ ++ unsigned int __fbc = (__fpriv)->xaa_fbc; \ ++ if ((__fpriv)->fbc_cache != __fbc || \ ++ (__fpriv)->rop_cache != __rop || \ ++ (__fpriv)->pmask_cache != (__pmask) || \ ++ (__fpriv)->drawop_cache != FFB_DRAWOP_VSCROLL) { \ ++ ffb_fbcPtr __ffb = (__fpriv)->regs; \ ++ (__fpriv)->fbc_cache = __fbc; \ ++ (__fpriv)->rop_cache = __rop; \ ++ (__fpriv)->pmask_cache = (__pmask); \ ++ (__fpriv)->drawop_cache = FFB_DRAWOP_VSCROLL; \ ++ (__fpriv)->rp_active = 1; \ ++ FFBFifo(__fpriv, 4); \ ++ (__ffb)->fbc = __fbc; \ ++ (__ffb)->rop = __rop; \ ++ (__ffb)->pmask = (__pmask); \ ++ (__ffb)->drawop = FFB_DRAWOP_VSCROLL; \ ++ } \ ++} while(0) ++ ++static CARD32 FFBAlphaTextureFormats[2] = { PICT_a8, 0 }; ++static CARD32 FFBTextureFormats[2] = { PICT_a8b8g8r8, 0 }; ++ ++static void FFB_SetupTextureAttrs(FFBPtr pFfb) ++{ ++ ffb_fbcPtr ffb = pFfb->regs; ++ unsigned int ppc = FFB_PPC_APE_DISABLE | FFB_PPC_CS_VAR | FFB_PPC_XS_VAR; ++ unsigned int ppc_mask = FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; ++ unsigned int rop = FFB_ROP_NEW | (FFB_ROP_NEW << 8); ++ unsigned int fbc = pFfb->xaa_fbc; ++ unsigned int wid = pFfb->xaa_wid; ++ ++ ppc |= FFB_PPC_ABE_ENABLE; ++ ppc_mask |= FFB_PPC_ABE_MASK; ++ ++ if ((pFfb->ppc_cache & ppc_mask) != ppc || ++ pFfb->fbc_cache != fbc || ++ pFfb->wid_cache != wid || ++ pFfb->rop_cache != rop || ++ pFfb->pmask_cache != 0xffffffff) ++ __FFB_Attr_SFB_VAR(pFfb, ppc, ppc_mask, fbc, ++ wid, rop, 0xffffffff); ++ FFBWait(pFfb, ffb); ++} ++ ++static Bool FFB_SetupForCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, int op, ++ CARD16 red, CARD16 green, CARD16 blue, ++ CARD16 alpha, int alphaType, ++ CARD8 *alphaPtr, int alphaPitch, ++ int width, int height, int flags) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ++ FFBLOG(("FFB_SetupForCPUToScreenAlphaTexture: " ++ "argb[%04x:%04x:%04x:%04x] alpha[T(%x):P(%d)] " ++ "wh[%d:%d] flgs[%x]\n", ++ alpha, red, green, blue, ++ alphaType, alphaPitch, ++ width, height, flags)); ++ ++ FFB_SetupTextureAttrs(pFfb); ++ ++ pFfb->xaa_tex = (unsigned char *) alphaPtr; ++ pFfb->xaa_tex_pitch = alphaPitch; ++ pFfb->xaa_tex_width = width; ++ pFfb->xaa_tex_height = height; ++ pFfb->xaa_tex_color = (/*((alpha >> 8) << 24) |*/ ++ ((blue >> 8) << 16) | ++ ((green >> 8) << 8) | ++ ((red >> 8) << 0)); ++ return TRUE; ++} ++ ++static void FFB_SubsequentCPUToScreenAlphaTexture(ScrnInfoPtr pScrn, ++ int dstx, int dsty, ++ int srcx, int srcy, ++ int width, int height) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ unsigned char *dst_base, *alpha_base, *sfb32; ++ unsigned int pixel_base; ++ int psz_shift = 2; ++ ++ FFBLOG(("FFB_SubsequentCPUToScreenAlphaTexture: " ++ "dst[%d:%d] src[%d:%d] wh[%d:%d]\n", ++ dstx, dsty, srcx, srcy, width, height)); ++ ++ sfb32 = (unsigned char *) pFfb->sfb32; ++ dst_base = sfb32 + (dsty * (2048 << psz_shift)) + (dstx << psz_shift); ++ alpha_base = pFfb->xaa_tex; ++ alpha_base += srcx; ++ if (srcy) ++ alpha_base += (srcy * pFfb->xaa_tex_pitch); ++ pixel_base = pFfb->xaa_tex_color; ++ while (height--) { ++ unsigned int *dst = (unsigned int *) dst_base; ++ unsigned char *alpha = alpha_base; ++ int w = width; ++ ++ while (w--) { ++ (*dst) = (((unsigned int)*alpha << 24) | pixel_base); ++ dst++; ++ alpha++; ++ } ++ dst_base += (2048 << psz_shift); ++ alpha_base += pFfb->xaa_tex_pitch; ++ } ++} ++ ++ ++static Bool FFB_SetupForCPUToScreenTexture(ScrnInfoPtr pScrn, int op, ++ int texType, ++ CARD8 *texPtr, int texPitch, ++ int width, int height, int flags) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ++ FFBLOG(("FFB_SetupForCPUToScreenTexture: " ++ "TEX[T(%x):P(%d)] " ++ "wh[%d:%d] flgs[%x]\n", ++ texType, texPitch, ++ width, height, flags)); ++ ++ FFB_SetupTextureAttrs(pFfb); ++ ++ pFfb->xaa_tex = (unsigned char *) texPtr; ++ pFfb->xaa_tex_pitch = texPitch; ++ pFfb->xaa_tex_width = width; ++ pFfb->xaa_tex_height = height; ++ ++ return TRUE; ++} ++ ++static void FFB_SubsequentCPUToScreenTexture(ScrnInfoPtr pScrn, ++ int dstx, int dsty, ++ int srcx, int srcy, ++ int width, int height) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ unsigned char *dst_base, *sfb32; ++ unsigned int *tex_base; ++ int psz_shift = 2; ++ ++ FFBLOG(("FFB_SubsequentCPUToScreenAlphaTexture: " ++ "dst[%d:%d] src[%d:%d] wh[%d:%d]\n", ++ dstx, dsty, srcx, srcy, width, height)); ++ ++ sfb32 = (unsigned char *) pFfb->sfb32; ++ dst_base = sfb32 + (dsty * (2048 << psz_shift)) + (dstx << psz_shift); ++ tex_base = (unsigned int *) pFfb->xaa_tex; ++ tex_base += srcx; ++ if (srcy) ++ tex_base += (srcy * pFfb->xaa_tex_pitch); ++ while (height--) { ++ unsigned int *dst = (unsigned int *) dst_base; ++ unsigned int *tex = tex_base; ++ int w = width; ++ while (w--) { ++ (*dst) = *tex; ++ ++ dst++; ++ tex++; ++ } ++ dst_base += (2048 << psz_shift); ++ tex_base += pFfb->xaa_tex_pitch; ++ } ++} ++ ++static void FFB_WritePixmap(ScrnInfoPtr pScrn, ++ int x, int y, int w, int h, ++ unsigned char *src, ++ int srcwidth, ++ int rop, ++ unsigned int planemask, ++ int trans, int bpp, int depth) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ unsigned char *dst, *sfb32; ++ int psz_shift = 2; ++ ffb_fbcPtr ffb = pFfb->regs; ++ ++ FFBLOG(("FFB_WritePixmap: " ++ "x[%d] y[%d] w[%d] h[%d] srcw[%d] rop[%d] pmask[%x] " ++ "trans[%d] bpp[%d] depth[%d]\n", ++ x, y, w, h, srcwidth, rop, planemask, ++ trans, bpp, depth)); ++ ++ FFB_ATTR_SFB_VAR_XAA(pFfb, planemask, rop); ++ FFBWait(pFfb, ffb); ++ ++ sfb32 = (unsigned char *) pFfb->sfb32; ++ dst = sfb32 + (y * (2048 << psz_shift)) + (x << psz_shift); ++ VISmoveImageLR(src, dst, w << psz_shift, h, ++ srcwidth, (2048 << psz_shift)); ++} ++ ++static void FFB_SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, ++ int pat_word1, int pat_word2, ++ int fg, int bg, int rop, ++ unsigned int planemask) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ unsigned int ppc, ppc_mask, fbc; ++ int i; ++ ++ FFBLOG(("FFB_SetupForMono8x8PatternFill: " ++ "pat[%08x:%08x] fg[%x] bg[%x] rop[%d] pmask[%x]\n", ++ pat_word1, pat_word2, ++ fg, bg, rop, planemask)); ++ ++ ppc = FFB_PPC_ABE_DISABLE | FFB_PPC_APE_ENABLE | FFB_PPC_CS_CONST; ++ if (bg < 0) ++ ppc |= FFB_PPC_TBE_TRANSPARENT; ++ else ++ ppc |= FFB_PPC_TBE_OPAQUE; ++ ppc_mask = FFB_PPC_ABE_MASK | FFB_PPC_APE_MASK | ++ FFB_PPC_TBE_MASK | FFB_PPC_CS_MASK; ++ fbc = pFfb->xaa_fbc; ++ rop = (rop | FFB_ROP_EDIT_BIT) | (FFB_ROP_NEW << 8); ++ ++ FFB_ATTR_RAW(pFfb, ppc, ppc_mask, planemask, rop, ++ FFB_DRAWOP_RECTANGLE, fg, fbc, pFfb->xaa_wid); ++ if (bg >= 0) ++ FFB_WRITE_BG(pFfb, ffb, bg); ++ ++ FFBFifo(pFfb, 32); ++ for (i = 0; i < 32; i += 2) { ++ CARD32 val1, val2; ++ int shift = (24 - ((i % 4) * 8)); ++ ++ if ((i % 8) < 4) { ++ val1 = (pat_word1 >> shift) & 0xff; ++ val2 = (pat_word1 >> (shift + 8)) & 0xff; ++ } else { ++ val1 = (pat_word2 >> shift) & 0xff; ++ val2 = (pat_word2 >> (shift + 8)) & 0xff; ++ } ++ val1 |= (val1 << 8) | (val1 << 16) | (val1 << 24); ++ val2 |= (val2 << 8) | (val2 << 16) | (val2 << 24); ++ FFB_WRITE64(&ffb->pattern[i], val1, val2); ++ } ++ pFfb->rp_active = 1; ++} ++ ++static void FFB_SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, ++ int pat_word1, int pat_word2, ++ int x, int y, int w, int h) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ ++ FFBLOG(("FFB_SubsequentMono8x8PatternFillRect: " ++ "x[%d] y[%d] w[%d] h[%d]\n", x, y, w, h)); ++ ++ FFBFifo(pFfb, 4); ++ FFB_WRITE64(&ffb->by, y, x); ++ FFB_WRITE64_2(&ffb->bh, h, w); ++} ++ ++static void FFB_SetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, ++ int fg, int bg, ++ int rop, ++ unsigned int planemask) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ unsigned int ppc, ppc_mask, fbc; ++ ++ FFBLOG(("FFB_SetupForScanlineCPUToScreenColorExpandFill: " ++ "fg[%x] bg[%x] rop[%d] pmask[%x]\n", ++ fg, bg, rop, planemask)); ++ ++ ppc = FFB_PPC_ABE_DISABLE | FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST; ++ if (bg < 0) ++ ppc |= FFB_PPC_TBE_TRANSPARENT; ++ else ++ ppc |= FFB_PPC_TBE_OPAQUE; ++ ppc_mask = FFB_PPC_ABE_MASK | FFB_PPC_APE_MASK | ++ FFB_PPC_TBE_MASK | FFB_PPC_CS_MASK; ++ fbc = pFfb->xaa_fbc; ++ rop = (rop | FFB_ROP_EDIT_BIT) | (FFB_ROP_NEW << 8); ++ ++ if ((pFfb->ppc_cache & ppc_mask) != ppc || ++ pFfb->fg_cache != fg || ++ pFfb->fbc_cache != fbc || ++ pFfb->rop_cache != rop || ++ pFfb->pmask_cache != planemask || ++ pFfb->fontinc_cache != ((0<<16) | 32) || ++ (bg >= 0 && pFfb->bg_cache != bg)) { ++ pFfb->ppc_cache &= ~ppc_mask; ++ pFfb->ppc_cache |= ppc; ++ pFfb->fg_cache = fg; ++ pFfb->fbc_cache = fbc; ++ pFfb->rop_cache = rop; ++ pFfb->pmask_cache = planemask; ++ pFfb->fontinc_cache = ((0<<16) | 32); ++ if (bg >= 0) ++ pFfb->bg_cache = bg; ++ FFBFifo(pFfb, (bg >= 0 ? 7 : 6)); ++ ffb->ppc = ppc; ++ ffb->fg = fg; ++ ffb->fbc = fbc; ++ ffb->rop = rop; ++ ffb->pmask = planemask; ++ ffb->fontinc = ((0 << 16) | 32); ++ if(bg >= 0) ++ ffb->bg = bg; ++ } ++ pFfb->rp_active = 1; ++} ++ ++static void FFB_SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, ++ int x, int y, int w, int h, ++ int skipleft) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ FFBLOG(("FFB_SubsequentCPUToScreenColorExpandFill: " ++ "x[%d] y[%d] w[%d] h[%d] skipleft[%d]\n", ++ x, y, w, h, skipleft)); ++ ++ pFfb->xaa_scanline_x = x; ++ pFfb->xaa_scanline_y = y; ++ pFfb->xaa_scanline_w = w; ++} ++ ++static void FFB_SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ CARD32 *bits = (CARD32 *) pFfb->xaa_scanline_buffers[bufno]; ++ int w; ++ ++ FFBFifo(pFfb, 1); ++ ffb->fontxy = ((pFfb->xaa_scanline_y << 16) | pFfb->xaa_scanline_x); ++ ++ w = pFfb->xaa_scanline_w; ++ if (w >= 32) { ++ FFB_WRITE_FONTW(pFfb, ffb, 32); ++ FFBFifo(pFfb, (w / 32)); ++ do { ++ ffb->font = *bits++; ++ w -= 32; ++ } while (w >= 32); ++ } ++ if (w > 0) { ++ FFB_WRITE_FONTW(pFfb, ffb, w); ++ FFBFifo(pFfb, 1); ++ ffb->font = *bits++; ++ } ++ ++ pFfb->xaa_scanline_y++; ++} ++ ++static void FFB_SetupForDashedLine(ScrnInfoPtr pScrn, ++ int fg, int bg, int rop, ++ unsigned int planemask, ++ int length, unsigned char *pattern) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ CARD32 *pat_ptr = (CARD32 *)pattern; ++ unsigned int ppc, ppc_mask, fbc; ++ ++ FFBLOG(("FFB_SetupForDashedLine: " ++ "fg[%x] bg[%x] rop[%d] pmask[%x] patlen[%d] pat[%x]\n", ++ fg, bg, rop, planemask, length, *pat_ptr)); ++ ++ pFfb->xaa_planemask = planemask; ++ pFfb->xaa_rop = rop; ++ pFfb->xaa_linepat = ++ (*pat_ptr << FFB_LPAT_PATTERN_SHIFT) | ++ (1 << FFB_LPAT_SCALEVAL_SHIFT) | ++ ((length & 0xf) << FFB_LPAT_PATLEN_SHIFT); ++ ++ fbc = pFfb->xaa_fbc; ++ ppc = FFB_PPC_ABE_DISABLE | FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST | FFB_PPC_XS_WID; ++ ppc_mask = FFB_PPC_ABE_MASK | FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; ++ ++ FFB_ATTR_RAW(pFfb, ppc, ppc_mask, planemask, ++ (FFB_ROP_EDIT_BIT | rop) | (FFB_ROP_NEW << 8), ++ FFB_DRAWOP_BRLINEOPEN, fg, fbc, pFfb->xaa_wid); ++ pFfb->rp_active = 1; ++} ++ ++static void FFB_SubsequentDashedTwoPointLine( ScrnInfoPtr pScrn, ++ int x1, int y1, ++ int x2, int y2, ++ int flags, int phase) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ unsigned int linepat = pFfb->xaa_linepat; ++ unsigned int drawop; ++ ++ FFBLOG(("FFB_SubsequentDashedTwoPointLine: " ++ "x1[%d] y1[%d] x2[%d] y2[%d] flgs[%x] phase[%d]\n", ++ x1, y2, x2, y2, flags, phase)); ++ ++ linepat |= (phase & 0xf) << FFB_LPAT_PATPTR_SHIFT; ++ ++ drawop = (flags & OMIT_LAST) ? ++ FFB_DRAWOP_BRLINEOPEN : FFB_DRAWOP_BRLINECAP; ++ FFB_WRITE_DRAWOP(pFfb, ffb, drawop); ++ ++ if (pFfb->has_brline_bug) { ++ FFBFifo(pFfb, 6); ++ ffb->ppc = 0; ++ } else ++ FFBFifo(pFfb, 5); ++ ffb->lpat = linepat; ++ FFB_WRITE64(&ffb->by, y1, x1); ++ FFB_WRITE64_2(&ffb->bh, y2, x2); ++} ++ ++static void FFB_SetupForSolidLine(ScrnInfoPtr pScrn, ++ int color, int rop, unsigned int planemask) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ unsigned int ppc, ppc_mask, fbc; ++ FFBLOG(("FFB_SetupForSolidLine: " ++ "color[%d] rop[%d] pmask[%x]\n", ++ color, rop, planemask)); ++ ++ pFfb->xaa_planemask = planemask; ++ pFfb->xaa_rop = rop; ++ ++ fbc = pFfb->xaa_fbc; ++ ppc = FFB_PPC_ABE_DISABLE | FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST | FFB_PPC_XS_WID; ++ ppc_mask = FFB_PPC_ABE_MASK | FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; ++ ++ FFB_ATTR_RAW(pFfb, ppc, ppc_mask, planemask, ++ (FFB_ROP_EDIT_BIT | rop) | (FFB_ROP_NEW << 8), ++ FFB_DRAWOP_BRLINEOPEN, color, fbc, pFfb->xaa_wid); ++ FFBFifo(pFfb, 1); ++ ffb->lpat = 0; ++ pFfb->rp_active = 1; ++} ++ ++static void FFB_SubsequentSolidTwoPointLine(ScrnInfoPtr pScrn, ++ int x1, int y1, ++ int x2, int y2, ++ int flags) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ int drawop; ++ ++ FFBLOG(("FFB_SubsequentSolidTwoPointLine: " ++ "x1[%d] y1[%d] x2[%d] y2[%d] flags[%d]\n", ++ x1, y1, x2, y2, flags)); ++ ++ drawop = (flags & OMIT_LAST) ? ++ FFB_DRAWOP_BRLINEOPEN : FFB_DRAWOP_BRLINECAP; ++ FFB_WRITE_DRAWOP(pFfb, ffb, drawop); ++ ++ if (pFfb->has_brline_bug) { ++ FFBFifo(pFfb, 5); ++ ffb->ppc = 0; ++ } else ++ FFBFifo(pFfb, 4); ++ FFB_WRITE64(&ffb->by, y1, x1); ++ FFB_WRITE64_2(&ffb->bh, y2, x2); ++} ++ ++void FFB_SetupForSolidFill(ScrnInfoPtr pScrn, ++ int color, int rop, unsigned int planemask) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ unsigned int ppc, ppc_mask, fbc; ++ ++ FFBLOG(("FFB_SetupForSolidFill: " ++ "color[%d] rop[%d] pmask[%u]\n", ++ color, rop, planemask)); ++ ++ pFfb->xaa_planemask = planemask; ++ pFfb->xaa_rop = rop; ++ ++ fbc = pFfb->xaa_fbc; ++ if (pFfb->ffb_res == ffb_res_high) ++ fbc |= FFB_FBC_WB_B; ++ ppc = FFB_PPC_ABE_DISABLE | FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST | FFB_PPC_XS_WID; ++ ppc_mask = FFB_PPC_ABE_MASK | FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; ++ ++ FFB_ATTR_RAW(pFfb, ppc, ppc_mask, planemask, ++ (FFB_ROP_EDIT_BIT | rop) | (FFB_ROP_NEW << 8), ++ FFB_DRAWOP_RECTANGLE, color, fbc, pFfb->xaa_wid); ++ pFfb->rp_active = 1; ++} ++ ++void FFB_SubsequentSolidFillRect(ScrnInfoPtr pScrn, ++ int x, int y, ++ int w, int h) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ ++ FFBLOG(("FFB_SubsequentSolidFillRect: " ++ "x[%d] y[%d] w[%d] h[%d]\n", x, y, w, h)); ++ ++ FFBFifo(pFfb, 4); ++ FFB_WRITE64(&ffb->by, y, x); ++ FFB_WRITE64_2(&ffb->bh, h, w); ++} ++ ++static void FFB_ScreenToScreenBitBlt(ScrnInfoPtr pScrn, ++ int nbox, ++ DDXPointPtr pptSrc, ++ BoxPtr pbox, ++ int xdir, int ydir, ++ int rop, unsigned int planemask) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ int use_vscroll; ++ ++ FFBLOG(("FFB_ScreenToScreenBitBlt: " ++ "nbox[%d] xdir[%d] ydir[%d] rop[%d] pmask[%x]\n", ++ nbox, xdir, ydir, rop, planemask)); ++ ++ use_vscroll = 0; ++ if (!pFfb->disable_vscroll && ++ rop == GXcopy) { ++ int i; ++ ++ for (i = 0; i < nbox; i++) ++ if (pptSrc[i].x != pbox[i].x1 || ++ pptSrc[i].y == pbox[i].y1) ++ break; ++ if (i == nbox) { ++ /* If/When double buffer extension is re-enabled ++ * check buffers here. ++ */ ++ use_vscroll = 1; ++ } ++ } ++ if (use_vscroll) { ++ FFB_ATTR_VSCROLL_XAA(pFfb, planemask); ++ while (nbox--) { ++ FFBFifo(pFfb, 7); ++ ffb->drawop = FFB_DRAWOP_VSCROLL; ++ FFB_WRITE64(&ffb->by, pptSrc->y, pptSrc->x); ++ FFB_WRITE64_2(&ffb->dy, pbox->y1, pbox->x1); ++ FFB_WRITE64_3(&ffb->bh, (pbox->y2 - pbox->y1), ++ (pbox->x2 - pbox->x1)); ++ ++ pbox++; ++ pptSrc++; ++ } ++ pFfb->rp_active = 1; ++ SET_SYNC_FLAG(pFfb->pXAAInfo); ++ } else { ++ unsigned char *sfb32 = (unsigned char *) pFfb->sfb32; ++ int psz_shift = 2; ++ ++ FFB_ATTR_SFB_VAR_XAA(pFfb, planemask, rop); ++ if (pFfb->use_blkread_prefetch) { ++ unsigned int bit; ++ ++ if (xdir < 0) ++ bit = FFB_MER_EDRA; ++ else ++ bit = FFB_MER_EIRA; ++ FFBFifo(pFfb, 1); ++ ffb->mer = bit; ++ pFfb->rp_active = 1; ++ } ++ FFBWait(pFfb, ffb); ++ ++ while (nbox--) { ++ unsigned char *src, *dst; ++ int x1, y1, x2, y2; ++ int width, height; ++ int sdkind; ++ ++ x1 = pptSrc->x; ++ y1 = pptSrc->y; ++ x2 = pbox->x1; ++ y2 = pbox->y1; ++ width = (pbox->x2 - pbox->x1); ++ height = (pbox->y2 - pbox->y1); ++ ++ src = sfb32 + (y1 * (2048 << psz_shift)) ++ + (x1 << psz_shift); ++ dst = sfb32 + (y2 * (2048 << psz_shift)) ++ + (x2 << psz_shift); ++ sdkind = (2048 << psz_shift); ++ ++ if (ydir < 0) { ++ src += ((height - 1) * (2048 << psz_shift)); ++ dst += ((height - 1) * (2048 << psz_shift)); ++ sdkind = -sdkind; ++ } ++ width <<= psz_shift; ++ if (xdir < 0) ++ VISmoveImageRL(src, dst, width, height, ++ sdkind, sdkind); ++ else ++ VISmoveImageLR(src, dst, width, height, ++ sdkind, sdkind); ++ pbox++; ++ pptSrc++; ++ } ++ if (pFfb->use_blkread_prefetch) { ++ FFBFifo(pFfb, 1); ++ ffb->mer = FFB_MER_DRA; ++ pFfb->rp_active = 1; ++ FFBWait(pFfb, ffb); ++ } ++ } ++} ++ ++void FFB_SetupForScreenToScreenCopy(ScrnInfoPtr pScrn, ++ int xdir, int ydir, int rop, ++ unsigned int planemask, ++ int trans_color) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ FFBLOG(("FFB_SetupForScreenToScreenCopy: " ++ "xdir[%d] ydir[%d] rop[%d] pmask[%x] tcolor[%d]\n", ++ xdir, ydir, rop, planemask, trans_color)); ++ ++ pFfb->xaa_planemask = planemask; ++ pFfb->xaa_xdir = xdir; ++ pFfb->xaa_ydir = ydir; ++ pFfb->xaa_rop = rop; ++ FFB_ATTR_SFB_VAR_XAA(pFfb, planemask, rop); ++ FFBWait(pFfb, ffb); ++} ++ ++void FFB_SubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, ++ int x1, int y1, ++ int x2, int y2, ++ int width, int height) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ unsigned char *src, *dst, *sfb32; ++ int psz_shift = 2; ++ int sdkind; ++ ++ FFBLOG(("FFB_SubsequentScreenToScreenCopy: " ++ "x1[%d] y1[%d] x2[%d] y2[%u] w[%d] h[%d]\n", ++ x1, y1, x2, y2, width, height)); ++ ++ sfb32 = (unsigned char *) pFfb->sfb32; ++ src = sfb32 + (y1 * (2048 << psz_shift)) + (x1 << psz_shift); ++ dst = sfb32 + (y2 * (2048 << psz_shift)) + (x2 << psz_shift); ++ sdkind = (2048 << psz_shift); ++ ++ if (pFfb->xaa_ydir < 0) { ++ src += ((height - 1) * (2048 << psz_shift)); ++ dst += ((height - 1) * (2048 << psz_shift)); ++ sdkind = -sdkind; ++ } ++ ++ width <<= psz_shift; ++ if (pFfb->xaa_xdir < 0) ++ VISmoveImageRL(src, dst, width, height, sdkind, sdkind); ++ else ++ VISmoveImageLR(src, dst, width, height, sdkind, sdkind); ++} ++ ++static void FFB_Sync(ScrnInfoPtr pScrn) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ffb_fbcPtr ffb = pFfb->regs; ++ ++ FFB_ATTR_SFB_VAR_XAA(pFfb, 0xffffffff, GXcopy); ++ FFBWait(pFfb, ffb); + } + + /* Multiplies and divides suck... */ +@@ -771,36 +840,15 @@ + } + } + +-static Bool +-CreatorPositionWindow(WindowPtr pWin, int x, int y) ++Bool FFBAccelInit(ScreenPtr pScreen, FFBPtr pFfb) + { +- if (pWin->drawable.bitsPerPixel == 8) +- return cfbPositionWindow(pWin, x, y); +- else +- return cfb32PositionWindow(pWin, x, y); +-} +- +-extern Bool CreatorCreateGC (GCPtr pGC); +- +-#ifdef DEBUG_FFB +-FILE *FDEBUG_FD = NULL; +-#endif +- +-BSFuncRec CreatorBSFuncRec = { +- CreatorSaveAreas, +- CreatorRestoreAreas, +- (BackingStoreSetClipmaskRgnProcPtr) 0, +- (BackingStoreGetImagePixmapProcPtr) 0, +- (BackingStoreGetSpansPixmapProcPtr) 0, +-}; +- +-Bool FFBAccelInit (ScreenPtr pScreen, FFBPtr pFfb) +-{ +- ffb_fbcPtr ffb; ++ XAAInfoRecPtr infoRec; ++ ffb_fbcPtr ffb = pFfb->regs; + + if (serverGeneration != CreatorGeneration) { + CreatorScreenPrivateIndex = AllocateScreenPrivateIndex (); +- if (CreatorScreenPrivateIndex == -1) return FALSE; ++ if (CreatorScreenPrivateIndex == -1) ++ return FALSE; + CreatorGCPrivateIndex = AllocateGCPrivateIndex (); + CreatorWindowPrivateIndex = AllocateWindowPrivateIndex (); + CreatorGeneration = serverGeneration; +@@ -810,32 +858,132 @@ + return FALSE; + if (!AllocateWindowPrivate(pScreen, CreatorWindowPrivateIndex, 0)) + return FALSE; ++ + pScreen->devPrivates[CreatorScreenPrivateIndex].ptr = pFfb; + +- pFfb->fifo_cache = 0; +- ffb = pFfb->regs; ++ pFfb->xaa_fbc = (FFB_FBC_WB_A | FFB_FBC_WM_COMBINED | FFB_FBC_RB_A | ++ FFB_FBC_WE_FORCEON | ++ FFB_FBC_SB_BOTH | ++ FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF | ++ FFB_FBC_RGBE_MASK | ++ FFB_FBC_XE_ON); ++ pFfb->xaa_wid = FFBWidAlloc(pFfb, TrueColor, 0, TRUE); ++ if (pFfb->xaa_wid == (unsigned int) -1) ++ return FALSE; ++ ++ pFfb->pXAAInfo = infoRec = XAACreateInfoRec(); ++ if (!infoRec) { ++ FFBWidFree(pFfb, pFfb->xaa_wid); ++ return FALSE; ++ } + +- /* Replace various screen functions. */ +- pScreen->CreateGC = CreatorCreateGC; +- pScreen->CreateWindow = CreatorCreateWindow; +- pScreen->DestroyWindow = CreatorDestroyWindow; +- pScreen->PositionWindow = CreatorPositionWindow; +- pScreen->ChangeWindowAttributes = CreatorChangeWindowAttributes; +- pScreen->PaintWindowBackground = CreatorPaintWindow; +- pScreen->PaintWindowBorder = CreatorPaintWindow; +- pScreen->GetSpans = CreatorGetSpans; +- pScreen->CopyWindow = CreatorCopyWindow; +- pScreen->GetImage = CreatorGetImage; +- pScreen->BackingStoreFuncs = CreatorBSFuncRec; ++ pFfb->xaa_scanline_buffers[0] = xalloc(2048 * 4); ++ if (!pFfb->xaa_scanline_buffers[0]) { ++ XAADestroyInfoRec(infoRec); ++ return FALSE; ++ } + +- /* cfb8_32wid took over this to init the WID plane, +- * and with how our code works that is not necessary. +- */ +- pScreen->WindowExposures = miWindowExposures; ++ pFfb->xaa_scanline_buffers[1] = xalloc(2048 * 4); ++ if (!pFfb->xaa_scanline_buffers[1]) { ++ xfree(pFfb->xaa_scanline_buffers[0]); ++ XAADestroyInfoRec(infoRec); ++ return FALSE; ++ } ++ ++ infoRec->Sync = FFB_Sync; + +- /* Set FFB line-bias for clipping. */ ++ /* Use VIS and VSCROLL for screen to screen copies. */ ++ infoRec->ScreenToScreenCopyFlags = NO_TRANSPARENCY; ++ infoRec->SetupForScreenToScreenCopy = ++ FFB_SetupForScreenToScreenCopy; ++ infoRec->SubsequentScreenToScreenCopy = ++ FFB_SubsequentScreenToScreenCopy; ++ ++ /* In order to optimize VSCROLL and prefetching properly we ++ * have to use our own mid-layer routine. ++ */ ++ infoRec->ScreenToScreenBitBltFlags = NO_TRANSPARENCY; ++ infoRec->ScreenToScreenBitBlt = ++ FFB_ScreenToScreenBitBlt; ++ ++ infoRec->SolidFillFlags = 0; ++ infoRec->SetupForSolidFill = ++ FFB_SetupForSolidFill; ++ infoRec->SubsequentSolidFillRect = ++ FFB_SubsequentSolidFillRect; ++ ++ infoRec->SolidLineFlags = 0; ++ infoRec->SetupForSolidLine = ++ FFB_SetupForSolidLine; ++ infoRec->SubsequentSolidTwoPointLine = ++ FFB_SubsequentSolidTwoPointLine; + miSetZeroLineBias(pScreen, OCTANT3 | OCTANT4 | OCTANT6 | OCTANT1); + ++ infoRec->DashedLineFlags = (TRANSPARENCY_ONLY | ++ LINE_PATTERN_LSBFIRST_LSBJUSTIFIED); ++ infoRec->DashPatternMaxLength = 16; ++ infoRec->SetupForDashedLine = ++ FFB_SetupForDashedLine; ++ infoRec->SubsequentDashedTwoPointLine = ++ FFB_SubsequentDashedTwoPointLine; ++ ++ /* We cannot use the non-scanline color expansion mechanism on FFB ++ * for two reasons: ++ * ++ * 1) A render pass can only render 32-pixels wide on FFB, XAA expects ++ * that arbitrary widths are possible per render pass. ++ * ++ * 2) The FFB accelerator FIFO is only 100 or so words deep, and ++ * XAA gives no way to limit the number of words it writes into ++ * the ColorExpandBase register per rendering pass. ++ */ ++ infoRec->ScanlineColorExpandBuffers = pFfb->xaa_scanline_buffers; ++ infoRec->NumScanlineColorExpandBuffers = 2; ++ infoRec->ScanlineCPUToScreenColorExpandFillFlags = ++ CPU_TRANSFER_PAD_DWORD | ++ SCANLINE_PAD_DWORD | ++ CPU_TRANSFER_BASE_FIXED | ++ BIT_ORDER_IN_BYTE_LSBFIRST; ++ infoRec->SetupForScanlineCPUToScreenColorExpandFill = ++ FFB_SetupForScanlineCPUToScreenColorExpandFill; ++ infoRec->SubsequentScanlineCPUToScreenColorExpandFill = ++ FFB_SubsequentScanlineCPUToScreenColorExpandFill; ++ infoRec->SubsequentColorExpandScanline = ++ FFB_SubsequentColorExpandScanline; ++ ++ infoRec->Mono8x8PatternFillFlags = ++ HARDWARE_PATTERN_PROGRAMMED_BITS | ++ HARDWARE_PATTERN_SCREEN_ORIGIN | ++ BIT_ORDER_IN_BYTE_LSBFIRST; ++ infoRec->SetupForMono8x8PatternFill = ++ FFB_SetupForMono8x8PatternFill; ++ infoRec->SubsequentMono8x8PatternFillRect = ++ FFB_SubsequentMono8x8PatternFillRect; ++ ++ /* Use VIS for pixmap writes. */ ++ infoRec->WritePixmap = FFB_WritePixmap; ++ ++ /* RENDER optimizations. */ ++ infoRec->CPUToScreenAlphaTextureFlags = ++ XAA_RENDER_NO_TILE | ++ XAA_RENDER_NO_SRC_ALPHA; ++ infoRec->CPUToScreenAlphaTextureFormats = FFBAlphaTextureFormats; ++ infoRec->SetupForCPUToScreenAlphaTexture = ++ FFB_SetupForCPUToScreenAlphaTexture; ++ infoRec->SubsequentCPUToScreenAlphaTexture = ++ FFB_SubsequentCPUToScreenAlphaTexture; ++ ++ infoRec->CPUToScreenTextureFlags = ++ XAA_RENDER_NO_TILE | ++ XAA_RENDER_NO_SRC_ALPHA; ++ infoRec->CPUToScreenTextureFormats = FFBTextureFormats; ++ infoRec->SetupForCPUToScreenTexture = ++ FFB_SetupForCPUToScreenTexture; ++ infoRec->SubsequentCPUToScreenTexture = ++ FFB_SubsequentCPUToScreenTexture; ++ ++ pFfb->fifo_cache = 0; ++ + FFB_DEBUG_init(); + FDEBUG((FDEBUG_FD, + "FFB: cfg0(%08x) cfg1(%08x) cfg2(%08x) cfg3(%08x) ppcfg(%08x)\n", +@@ -904,26 +1052,31 @@ + + pFfb->ppc_cache = (FFB_PPC_FW_DISABLE | + FFB_PPC_VCE_DISABLE | FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST | +- FFB_PPC_XS_CONST | FFB_PPC_YS_CONST | FFB_PPC_ZS_CONST | ++ FFB_PPC_XS_WID | FFB_PPC_YS_CONST | FFB_PPC_ZS_CONST | + FFB_PPC_DCE_DISABLE | FFB_PPC_ABE_DISABLE | FFB_PPC_TBE_OPAQUE); +- ++ pFfb->wid_cache = pFfb->xaa_wid; + pFfb->pmask_cache = ~0; +- pFfb->rop_cache = (FFB_ROP_ZERO | (FFB_ROP_NEW << 8)); ++ pFfb->rop_cache = (FFB_ROP_NEW | (FFB_ROP_NEW << 8)); + pFfb->drawop_cache = FFB_DRAWOP_RECTANGLE; + pFfb->fg_cache = pFfb->bg_cache = 0; + pFfb->fontw_cache = 32; + pFfb->fontinc_cache = (1 << 16) | 0; +- pFfb->fbc_cache = (FFB_FBC_WB_A | FFB_FBC_WM_COMBINED | +- FFB_FBC_RB_A | FFB_FBC_SB_BOTH | FFB_FBC_XE_OFF | +- FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF | FFB_FBC_RGBE_MASK); ++ pFfb->fbc_cache = (FFB_FBC_WB_A | FFB_FBC_WM_COMBINED | FFB_FBC_RB_A | ++ FFB_FBC_WE_FORCEON | ++ FFB_FBC_SB_BOTH | ++ FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF | ++ FFB_FBC_RGBE_OFF | ++ FFB_FBC_XE_ON); + pFfb->laststipple = NULL; + + /* We will now clear the screen: we'll draw a rectangle covering all the + * viewscreen, using a 'blackness' ROP. + */ +- FFBFifo(pFfb, 13); ++ FFBFifo(pFfb, 22); + ffb->fbc = pFfb->fbc_cache; + ffb->ppc = pFfb->ppc_cache; ++ ffb->wid = pFfb->wid_cache; ++ ffb->xpmask = 0xff; + ffb->pmask = pFfb->pmask_cache; + ffb->rop = pFfb->rop_cache; + ffb->drawop = pFfb->drawop_cache; +@@ -931,31 +1084,32 @@ + ffb->bg = pFfb->bg_cache; + ffb->fontw = pFfb->fontw_cache; + ffb->fontinc = pFfb->fontinc_cache; ++ ffb->xclip = FFB_XCLIP_TEST_ALWAYS; ++ ffb->cmp = 0x80808080; ++ ffb->matchab = 0x80808080; ++ ffb->magnab = 0x80808080; ++ ffb->blendc = (FFB_BLENDC_FORCE_ONE | ++ FFB_BLENDC_DF_ONE_M_A | ++ FFB_BLENDC_SF_A); ++ ffb->blendc1 = 0; ++ ffb->blendc2 = 0; + FFB_WRITE64(&ffb->by, 0, 0); + FFB_WRITE64_2(&ffb->bh, pFfb->psdp->height, pFfb->psdp->width); + pFfb->rp_active = 1; + FFBWait(pFfb, ffb); + +- /* Fixup the FBC/PPC caches to deal with actually using +- * a WID for every ROP. +- */ +- pFfb->fbc_cache = (FFB_FBC_WB_A | FFB_FBC_WM_COMBINED | +- FFB_FBC_RB_A | FFB_FBC_SB_BOTH | FFB_FBC_XE_ON | +- FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF | FFB_FBC_RGBE_ON); +- pFfb->ppc_cache &= ~FFB_PPC_XS_MASK; +- pFfb->ppc_cache |= FFB_PPC_XS_WID; +- pFfb->wid_cache = 0xff; +- FFBFifo(pFfb, 8); +- ffb->fbc = pFfb->fbc_cache; +- ffb->ppc = FFB_PPC_XS_WID; +- ffb->wid = pFfb->wid_cache; +- ffb->xpmask = 0xff; +- ffb->xclip = FFB_XCLIP_TEST_ALWAYS; +- ffb->cmp = 0x80808080; +- ffb->matchab = 0x80808080; +- ffb->magnab = 0x80808080; ++ FFB_ATTR_SFB_VAR_XAA(pFfb, 0xffffffff, GXcopy); + FFBWait(pFfb, ffb); + ++ if (!XAAInit(pScreen, infoRec)) { ++ XAADestroyInfoRec(infoRec); ++ xfree(pFfb->xaa_scanline_buffers[0]); ++ xfree(pFfb->xaa_scanline_buffers[1]); ++ pFfb->pXAAInfo = NULL; ++ FFBWidFree(pFfb, pFfb->xaa_wid); ++ return FALSE; ++ } ++ + /* Success */ + return TRUE; + } +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_bcopy.c xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_bcopy.c +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_bcopy.c 2004-04-23 21:48:16.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_bcopy.c 2004-11-16 14:01:46.706984752 +0100 +@@ -382,7 +382,6 @@ + if (use_prefetch) { + FFBFifo(pFfb, 1); + pFfb->regs->mer = FFB_MER_EDRA; +- pFfb->regs->mer = FFB_MER_EIRA; + pFfb->rp_active = 1; + } + VISmoveImageRL ((psrcBase + +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c 2004-04-23 21:48:16.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dga.c 2004-11-16 14:01:46.706984752 +0100 +@@ -35,30 +35,16 @@ + #include "ffb_stip.h" + #include "ffb_loops.h" + +-static Bool FFB_OpenFramebuffer(ScrnInfoPtr pScrn, char **name, unsigned char **mem, +- int *size, int *offset, int *extra); +-static void FFB_CloseFramebuffer(ScrnInfoPtr pScrn); +-static Bool FFB_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode); +-static void FFB_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags); +-static int FFB_GetViewport(ScrnInfoPtr pScrn); +-static void FFB_Flush(ScrnInfoPtr pScrn); +- +-/* Have to disable all this stuff for now until I figure out where +- * we should get the WID values from... ho hum... -DaveM +- */ +-#if 0 +-static void FFB_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color); +- +-#ifdef USE_VIS +-static void FFB_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, int w, int h, +- int dstx, int dsty); +-#else +-#define FFB_BlitRect NULL +-#endif +-#else +-#define FFB_FillRect NULL +-#define FFB_BlitRect NULL +-#endif ++static Bool FFB_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, ++ int *, int *, int *); ++static void FFB_CloseFramebuffer(ScrnInfoPtr); ++static Bool FFB_SetMode(ScrnInfoPtr, DGAModePtr); ++static void FFB_SetViewport(ScrnInfoPtr, int, int, int); ++static int FFB_GetViewport(ScrnInfoPtr); ++static void FFB_Flush(ScrnInfoPtr); ++static void FFB_FillRect(ScrnInfoPtr, int, int, int, int, unsigned long); ++static void FFB_BlitRect(ScrnInfoPtr, int, int, int, int, ++ int, int); + + static DGAFunctionRec FFB_DGAFuncs = { + FFB_OpenFramebuffer, +@@ -93,10 +79,7 @@ + + /* Hmmm, what does concurrent access really mean? -DaveM */ + mode->flags = (DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE | DGA_FILL_RECT); +- +-#ifdef USE_VIS + mode->flags |= DGA_BLIT_RECT; +-#endif + + mode->imageWidth = 2048; + mode->imageHeight = 2048; +@@ -195,86 +178,31 @@ + FFBWait(pFfb, ffb); + } + +-#if 0 +- +-extern void CreatorFillBoxSolid (DrawablePtr pDrawable, int nBox, +- BoxPtr pBox, unsigned long pixel); ++extern void FFB_SetupForSolidFill(ScrnInfoPtr, int, int, unsigned int); ++extern void FFB_SubsequentSolidFillRect(ScrnInfoPtr, int, int, int, int); + + static void FFB_FillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned long color) + { +- DrawableRec draw; +- BoxRec box; +- +- draw.pScreen = pScrn->pScreen; +- box.x1 = x; +- box.y1 = y; +- box.x2 = x + w; +- box.y2 = y + h; ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); + +- CreatorFillBoxSolid(&draw, 1, &box, color); ++ FFB_SetupForSolidFill(pScrn, color, GXcopy, ~0); ++ FFB_SubsequentSolidFillRect(pScrn, x, y, w, h); ++ SET_SYNC_FLAG(pFfb->pXAAInfo); + } + +-#ifdef USE_VIS +-extern void VISmoveImageLR(unsigned char *, unsigned char *, long, long, long, long); +-extern void VISmoveImageRL(unsigned char *, unsigned char *, long, long, long, long); ++extern void FFB_SetupForScreenToScreenCopy(ScrnInfoPtr, int, int, int, ++ unsigned int, int); ++extern void FFB_SubsequentScreenToScreenCopy(ScrnInfoPtr, int, int, ++ int, int, int, int); + + static void FFB_BlitRect(ScrnInfoPtr pScrn, int srcx, int srcy, + int w, int h, int dstx, int dsty) + { + FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); +- ffb_fbcPtr ffb = pFfb->regs; +- +- if (!pFfb->disable_vscroll && +- dstx == srcx && +- dsty != dsty) { +- FFB_WRITE_ATTRIBUTES_VSCROLL(pFfb, 0x00ffffff); +- FFBFifo(pFfb, 7); +- ffb->drawop = FFB_DRAWOP_VSCROLL; +- FFB_WRITE64(&ffb->by, srcy, srcx); +- FFB_WRITE64_2(&ffb->dy, dsty, dstx); +- FFB_WRITE64_3(&ffb->bh, h, w); +- pFfb->rp_active = 1; +- } else { +- unsigned char *base = (unsigned char *)pFfb->fb; +- int use_prefetch = pFfb->use_blkread_prefetch; ++ int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; ++ int ydir = (srcy < dsty) ? -1 : 1; + +- FFB_WRITE_ATTRIBUTES_SFB_VAR(pFfb, 0x00ffffff, GXcopy); +- FFBWait(pFfb, ffb); +- if (use_prefetch) { +- FFBFifo(pFfb, 1); +- ffb->mer = FFB_MER_EIRA; +- pFfb->rp_active = 1; +- FFBWait(pFfb, ffb); +- } +- if (srcx < dstx) { +- VISmoveImageRL((base + +- ((srcy + h - 1) * (2048 * 4)) + +- (srcx * (32 / 8))), +- (base + +- ((dsty + h - 1) * (2048 * 4)) + +- (dstx * (32 / 8))), +- (w * (32 / 8)), +- h, +- -(2048 * 4), - (2048 * 4)); +- } else { +- VISmoveImageLR((base + +- ((srcy + h - 1) * (2048 * 4)) + +- (srcx * (32 / 8))), +- (base + +- ((dsty + h - 1) * (2048 * 4)) + +- (dstx * (32 / 8))), +- (w * (32 / 8)), +- h, +- -(2048 * 4), - (2048 * 4)); +- } +- if (use_prefetch) { +- FFBFifo(pFfb, 1); +- ffb->mer = FFB_MER_DRA; +- pFfb->rp_active = 1; +- FFBWait(pFfb, pFfb->regs); +- } +- } ++ FFB_SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, ~0, -1); ++ FFB_SubsequentScreenToScreenCopy(pScrn, srcx, srcy, dstx,dsty, w, h); ++ SET_SYNC_FLAG(pFfb->pXAAInfo); + } +-#endif +- +-#endif +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c 2004-04-23 21:48:16.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c 2004-11-16 14:01:46.707984600 +0100 +@@ -29,12 +29,7 @@ + #include "mipointer.h" + #include "mibstore.h" + #include "micmap.h" +- +-#define PSZ 8 +-#include "cfb.h" +-#undef PSZ +-#include "cfb32.h" +-#include "cfb8_32wid.h" ++#include "fb.h" + + #include "xf86cmap.h" + +@@ -50,6 +45,7 @@ + static void FFBLeaveVT(int scrnIndex, int flags); + static Bool FFBCloseScreen(int scrnIndex, ScreenPtr pScreen); + static Bool FFBSaveScreen(ScreenPtr pScreen, int mode); ++static void FFBDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); + + /* Required if the driver supports mode switching */ + static Bool FFBSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); +@@ -416,12 +412,12 @@ + return FALSE; + } + +- if (xf86LoadSubModule(pScrn, "cfb32") == NULL) { ++ if (xf86LoadSubModule(pScrn, "fb") == NULL) { + FFBFreeRec(pScrn); + return FALSE; + } + +- if (xf86LoadSubModule(pScrn, "cfb") == NULL) { ++ if (xf86LoadSubModule(pScrn, "xaa") == NULL) { + FFBFreeRec(pScrn); + return FALSE; + } +@@ -570,8 +566,6 @@ + pFfb->has_z_buffer = 0; + } + if (sbits & (1 << 0)) { +- ErrorF("Double-buffered.\n"); +- + /* This state really means to the driver that the double + * buffers are available for hw accelerate Dbe. When the + * FFB is in high-resolution mode, the buffers are combined +@@ -581,86 +575,17 @@ + if ((ffb->fbcfg0 & FFB_FBCFG0_RES_MASK) != FFB_FBCFG0_RES_HIGH) + pFfb->has_double_buffer = 1; + else +- pFfb->has_double_buffer = 1; ++ pFfb->has_double_buffer = 0; + } else { +- ErrorF("Single-buffered.\n"); + pFfb->has_double_buffer = 0; + } ++ if (pFfb->has_double_buffer) ++ ErrorF("Double-buffered.\n"); ++ else ++ ErrorF("Single-buffered.\n"); + } + } + +-static unsigned long CreatorUnaccelGeneration = 0; +-static int CreatorUnaccelWindowPrivateIndex; +- +-#define CreatorUnaccelGetWid(w) \ +- ((w)->devPrivates[CreatorUnaccelWindowPrivateIndex].val) +-#define CreatorUnaccelSetWid(w,wid) \ +- (((w)->devPrivates[CreatorUnaccelWindowPrivateIndex].val) = (wid)) +- +-static unsigned int +-CreatorWidGet(WindowPtr pWin) +-{ +- return CreatorUnaccelGetWid(pWin); +-} +- +-static Bool +-CreatorWidAlloc(WindowPtr pWin) +-{ +- ScreenPtr pScreen = pWin->drawable.pScreen; +- ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; +- FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); +- unsigned int wid; +- int i, visual, visclass; +- +- visual = wVisual(pWin); +- visclass = 0; +- for (i = 0; i < pScreen->numVisuals; i++) { +- if (pScreen->visuals[i].vid == visual) { +- visclass = pScreen->visuals[i].class; +- break; +- } +- } +- +- wid = FFBWidAlloc(pFfb, visclass, wColormap(pWin), TRUE); +- if (wid == (unsigned int) -1) +- return FALSE; +- +- CreatorUnaccelSetWid(pWin, wid); +- +- return TRUE; +-} +- +-static void +-CreatorWidFree(WindowPtr pWin) +-{ +- ScrnInfoPtr pScrn = xf86Screens[pWin->drawable.pScreen->myNum]; +- FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); +- unsigned int wid = CreatorUnaccelGetWid(pWin); +- +- FFBWidFree(pFfb, wid); +-} +- +-static cfb8_32WidOps CreatorUnaccelWidOps = { +- CreatorWidGet, +- CreatorWidAlloc, +- CreatorWidFree, +- NULL, +- NULL +-}; +- +-static Bool +-CreatorUnaccelWidInit(ScreenPtr pScreen) +-{ +- if (serverGeneration != CreatorUnaccelGeneration) { +- CreatorUnaccelWindowPrivateIndex = +- AllocateWindowPrivateIndex(); +- if (CreatorUnaccelWindowPrivateIndex == -1) +- return FALSE; +- } +- +- return TRUE; +-} +- + /* Mandatory */ + + /* This gets called at the start of each server generation */ +@@ -674,10 +599,6 @@ + unsigned int afb_fem; + VisualPtr visual; + +- /* Add in our Dbe hook. */ +- if (!FFBDbePreInit(pScreen)) +- return FALSE; +- + /* + * First get the ScrnInfoRec + */ +@@ -797,11 +718,6 @@ + /* Darken the screen for aesthetic reasons and set the viewport */ + FFBSaveScreen(pScreen, SCREEN_SAVER_ON); + +- if (pFfb->NoAccel == TRUE) { +- if (!CreatorUnaccelWidInit(pScreen)) +- return FALSE; +- } +- + /* + * The next step is to setup the screen's visuals, and initialise the + * framebuffer code. In cases where the framebuffer's default +@@ -817,14 +733,14 @@ + miClearVisualTypes(); + + /* Setup the visuals we support. */ +- if (!miSetVisualTypes(24, TrueColorMask | DirectColorMask, ++ if (!miSetVisualTypes(24, TrueColorMask, + pScrn->rgbBits, TrueColor)) + return FALSE; +- if (!miSetVisualTypes(8, PseudoColorMask | GrayScaleMask | StaticGrayMask, +- pScrn->rgbBits, PseudoColor)) +- return FALSE; + +-#ifdef XF86DRI ++ if (!miSetPixmapDepths()) ++ return FALSE; ++ ++#if 0 /*def XF86DRI*/ + if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6 && + pFfb->NoAccel == FALSE) { + pFfb->dri_enabled = FFBDRIScreenInit(pScreen); +@@ -843,30 +759,14 @@ + * Call the framebuffer layer's ScreenInit function, and fill in other + * pScreen fields. + */ +- if (pFfb->NoAccel == TRUE) { +- ret = cfb8_32WidScreenInit(pScreen, pFfb->dfb24, pFfb->dfb8r, pFfb->dfb8x, +- pScrn->virtualX, pScrn->virtualY, +- pScrn->xDpi, pScrn->yDpi, +- 2048, 2048, 2048, 8, +- &CreatorUnaccelWidOps); +- } else { +- /* Use smart framebuffer aperture for cfb8/cfb32. */ +- ret = cfb8_32WidScreenInit(pScreen, pFfb->sfb32, pFfb->sfb8r, pFfb->dfb8x, +- pScrn->virtualX, pScrn->virtualY, +- pScrn->xDpi, pScrn->yDpi, +- 2048, 2048, 2048, 8, +- &CreatorUnaccelWidOps); +- } ++ ret = fbScreenInit(pScreen, (pFfb->NoAccel ? pFfb->dfb24 : pFfb->sfb32), ++ pScrn->virtualX, pScrn->virtualY, ++ pScrn->xDpi, pScrn->yDpi, ++ 2048, 32); + + if (!ret) + return FALSE; + +- miInitializeBackingStore(pScreen); +- xf86SetBackingStore(pScreen); +- xf86SetSilkenMouse(pScreen); +- +- xf86SetBlackWhitePixels(pScreen); +- + if (pScrn->bitsPerPixel > 8) { + /* Fixup RGB ordering */ + visual = pScreen->visuals + pScreen->numVisuals; +@@ -882,12 +782,24 @@ + } + } + ++ if (!fbPictureInit(pScreen, NULL, 0) && ++ (serverGeneration == 1)) ++ xf86DrvMsg(pScrn->scrnIndex, X_WARNING, ++ "RENDER extension initialisation failed.\n"); ++ ++ xf86SetBlackWhitePixels(pScreen); ++ + if (!pFfb->NoAccel) { + if (!FFBAccelInit(pScreen, pFfb)) + return FALSE; + xf86Msg(X_INFO, "%s: Using acceleration\n", pFfb->psdp->device); + } + ++ ++ miInitializeBackingStore(pScreen); ++ xf86SetBackingStore(pScreen); ++ xf86SetSilkenMouse(pScreen); ++ + /* Initialise cursor functions */ + miDCInitialize (pScreen, xf86GetPointerScreenFuncs()); + +@@ -912,9 +824,6 @@ + */ + if (!xf86HandleColormaps(pScreen, 256, 8, + FFBDacLoadPalette, NULL, +-#if 0 +- CMAP_PALETTED_TRUECOLOR | +-#endif + CMAP_LOAD_EVEN_IF_OFFSCREEN | + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; +@@ -923,9 +832,9 @@ + if (!pFfb->NoAccel) + FFB_InitDGA(pScreen); + +-#ifdef XF86DRI ++#if 0 /*def XF86DRI*/ + if (pFfb->dri_enabled) { +- /* Now that mi, cfb, drm and others have done their thing, ++ /* Now that mi, fb, drm and others have done their thing, + * complete the DRI setup. + */ + pFfb->dri_enabled = FFBDRIFinishScreenInit(pScreen); +@@ -938,6 +847,8 @@ + } + #endif + ++ xf86DPMSInit(pScreen, FFBDPMSSet, 0); ++ + pFfb->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = FFBCloseScreen; + pScreen->SaveScreen = FFBSaveScreen; +@@ -1034,34 +945,34 @@ + static Bool + FFBCloseScreen(int scrnIndex, ScreenPtr pScreen) + { +- ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; +- FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); + +-#ifdef XF86DRI +- if (pFfb->dri_enabled) +- FFBDRICloseScreen(pScreen); ++#if 0 /*def XF86DRI*/ ++ if (pFfb->dri_enabled) ++ FFBDRICloseScreen(pScreen); + #endif + +- /* Restore kernel ramdac state before we unmap registers. */ +- FFBDacFini(pFfb); ++ /* Restore kernel ramdac state before we unmap registers. */ ++ FFBDacFini(pFfb); + +- pScrn->vtSema = FALSE; ++ pScrn->vtSema = FALSE; + +- xf86UnmapSbusMem(pFfb->psdp, pFfb->dfb24, 0x1000000); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->dfb8r, 0x400000); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->dfb8x, 0x400000); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->sfb32, 0x1000000); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->sfb8r, 0x400000); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->sfb8x, 0x400000); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->regs, 16384); +- xf86UnmapSbusMem(pFfb->psdp, pFfb->dac, 8192); +- xf86UnmapSbusMem(pFfb->psdp, (void *)pFfb->strapping_bits, 8192); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->dfb24, 0x1000000); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->dfb8r, 0x400000); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->dfb8x, 0x400000); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->sfb32, 0x1000000); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->sfb8r, 0x400000); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->sfb8x, 0x400000); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->regs, 16384); ++ xf86UnmapSbusMem(pFfb->psdp, pFfb->dac, 8192); ++ xf86UnmapSbusMem(pFfb->psdp, (void *)pFfb->strapping_bits, 8192); + +- if (pFfb->HWCursor) +- xf86SbusHideOsHwCursor (pFfb->psdp); ++ if (pFfb->HWCursor) ++ xf86SbusHideOsHwCursor (pFfb->psdp); + +- pScreen->CloseScreen = pFfb->CloseScreen; +- return (*pScreen->CloseScreen)(scrnIndex, pScreen); ++ pScreen->CloseScreen = pFfb->CloseScreen; ++ return (*pScreen->CloseScreen)(scrnIndex, pScreen); + } + + +@@ -1071,7 +982,7 @@ + static void + FFBFreeScreen(int scrnIndex, int flags) + { +- FFBFreeRec(xf86Screens[scrnIndex]); ++ FFBFreeRec(xf86Screens[scrnIndex]); + } + + +@@ -1081,10 +992,10 @@ + static ModeStatus + FFBValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) + { +- if (mode->Flags & V_INTERLACE) +- return(MODE_BAD); ++ if (mode->Flags & V_INTERLACE) ++ return MODE_BAD; + +- return(MODE_OK); ++ return MODE_OK; + } + + /* Do screen blanking */ +@@ -1102,6 +1013,14 @@ + return FFBDacSaveScreen(GET_FFB_FROM_SCREEN(pScreen), mode); + } + ++static void ++FFBDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) ++{ ++ FFBPtr pFfb = GET_FFB_FROM_SCRN(pScrn); ++ ++ FFBDacDPMSMode(pFfb, mode, 0); ++} ++ + /* + * This is the implementation of the Sync() function. + */ +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h 2004-04-23 21:48:16.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h 2004-11-16 14:01:46.702985360 +0100 +@@ -33,6 +33,7 @@ + #include "xf86_OSproc.h" + #include "xf86_ansic.h" + #include "xf86RamDac.h" ++#include "xaa.h" + #include "Xmd.h" + #include "gcstruct.h" + #include "windowstr.h" +@@ -188,6 +189,19 @@ + unsigned char has_z_buffer; + unsigned char has_double_buffer; + ++ /* XAA related info */ ++ XAAInfoRecPtr pXAAInfo; ++ unsigned int xaa_fbc; ++ unsigned int xaa_wid; ++ unsigned int xaa_planemask; ++ unsigned int xaa_linepat; ++ int xaa_xdir, xaa_ydir, xaa_rop; ++ unsigned char *xaa_scanline_buffers[2]; ++ int xaa_scanline_x, xaa_scanline_y, xaa_scanline_w; ++ unsigned char *xaa_tex; ++ int xaa_tex_pitch, xaa_tex_width, xaa_tex_height; ++ unsigned int xaa_tex_color; ++ + enum ffb_resolution ffb_res; + BoxRec ClippedBoxBuf[64]; + xRectangle Pf_Fixups[4]; +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_rcache.h xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_rcache.h +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_rcache.h 2004-04-23 21:48:17.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_rcache.h 2004-11-16 14:01:46.708984448 +0100 +@@ -41,13 +41,13 @@ + * a nice idea... + */ + #define FFB_WRITE_PPC(__fpriv, __ffb, __val, __chg_mask) \ +-do { unsigned int oldval = (__fpriv)->ppc_cache; \ ++do { unsigned int __oldval = (__fpriv)->ppc_cache; \ + unsigned int __t; \ +- __t = (oldval & (__chg_mask)) ^ (__val); \ ++ __t = (__oldval & (__chg_mask)) ^ (__val); \ + if (__t) { \ +- unsigned int newval = oldval & ~(__chg_mask); \ +- newval |= (__val); \ +- (__fpriv)->ppc_cache = newval; \ ++ unsigned int __newval = __oldval & ~(__chg_mask); \ ++ __newval |= (__val); \ ++ (__fpriv)->ppc_cache = __newval; \ + FFBFifo((__fpriv), 1); \ + (__ffb)->ppc = (__val); \ + } \ +@@ -178,22 +178,22 @@ + #define FFB_ATTR_FFWIN(__fpriv, __pwin, __ppc, __pixel) \ + do { CreatorPrivWinPtr __winpriv = CreatorGetWindowPrivate(__pwin); \ + unsigned int ___ppc = (__ppc) | FFB_PPC_XS_WID; \ +- unsigned int fbc = (__winpriv)->fbc_base; \ +- unsigned int rop = (FFB_ROP_NEW|(FFB_ROP_NEW<<8)); \ ++ unsigned int __fbc = (__winpriv)->fbc_base; \ ++ unsigned int __rop = (FFB_ROP_NEW|(FFB_ROP_NEW<<8)); \ + if((__fpriv)->has_double_buffer) { \ +- fbc &= ~FFB_FBC_WB_MASK; \ +- fbc |= FFB_FBC_WB_AB; \ ++ __fbc &= ~FFB_FBC_WB_MASK; \ ++ __fbc |= FFB_FBC_WB_AB; \ + } \ +- fbc &= ~(FFB_FBC_XE_MASK | FFB_FBC_RGBE_MASK); \ +- fbc |= FFB_FBC_XE_ON | FFB_FBC_RGBE_ON; \ ++ __fbc &= ~(FFB_FBC_XE_MASK | FFB_FBC_RGBE_MASK); \ ++ __fbc |= FFB_FBC_XE_ON | FFB_FBC_RGBE_ON; \ + if (pFfb->ffb_res == ffb_res_high) \ +- fbc |= FFB_FBC_WB_B; \ ++ __fbc |= FFB_FBC_WB_B; \ + if ((((__fpriv)->ppc_cache & FFB_PPC_WINMASK) != (___ppc))|| \ + ((__fpriv)->pmask_cache != 0x00ffffff) || \ +- ((__fpriv)->rop_cache!= rop) || \ ++ ((__fpriv)->rop_cache!= __rop) || \ + ((__fpriv)->drawop_cache != FFB_DRAWOP_FASTFILL) || \ + ((__fpriv)->fg_cache != (__pixel)) || \ +- ((__fpriv)->fbc_cache != fbc) || \ ++ ((__fpriv)->fbc_cache != __fbc) || \ + ((__fpriv)->wid_cache != ((__winpriv)->wid))) \ + __FFB_Attr_FastfillWin(__fpriv, __pwin, ___ppc, __pixel);\ + } while (0) +@@ -215,29 +215,29 @@ + FFB_FBC_ZE_OFF | FFB_FBC_YE_OFF | FFB_FBC_RGBE_ON) + + #define FFB_ATTR_SFB_VAR_WINCOPY(__fpriv) \ +-do { unsigned int ppc = FFB_PPC_WINCOPY; \ +- unsigned int ppc_mask = FFB_PPC_WINCOPY_MASK; \ +- unsigned int rop = FFB_ROP_NEW|(FFB_ROP_NEW<<8); \ +- unsigned int fbc = FFB_FBC_WINCOPY; \ ++do { unsigned int __ppc = FFB_PPC_WINCOPY; \ ++ unsigned int __ppc_mask = FFB_PPC_WINCOPY_MASK; \ ++ unsigned int __rop = FFB_ROP_NEW|(FFB_ROP_NEW<<8); \ ++ unsigned int __fbc = FFB_FBC_WINCOPY; \ + if((__fpriv)->has_double_buffer) { \ +- fbc &= ~FFB_FBC_WB_MASK; \ +- fbc |= FFB_FBC_WB_AB; \ ++ __fbc &= ~FFB_FBC_WB_MASK; \ ++ __fbc |= FFB_FBC_WB_AB; \ + } \ +- if (((__fpriv)->ppc_cache & ppc_mask) != ppc || \ +- (__fpriv)->fbc_cache != fbc || \ +- (__fpriv)->rop_cache != rop || \ ++ if (((__fpriv)->ppc_cache & __ppc_mask) != __ppc || \ ++ (__fpriv)->fbc_cache != __fbc || \ ++ (__fpriv)->rop_cache != __rop || \ + (__fpriv)->pmask_cache != 0xffffffff) { \ + ffb_fbcPtr __ffb = (__fpriv)->regs; \ +- (__fpriv)->ppc_cache &= ~ppc_mask; \ +- (__fpriv)->ppc_cache |= ppc; \ +- (__fpriv)->fbc_cache = fbc; \ +- (__fpriv)->rop_cache = rop; \ ++ (__fpriv)->ppc_cache &= ~__ppc_mask; \ ++ (__fpriv)->ppc_cache |= __ppc; \ ++ (__fpriv)->fbc_cache = __fbc; \ ++ (__fpriv)->rop_cache = __rop; \ + (__fpriv)->pmask_cache = 0xffffffff; \ + (__fpriv)->rp_active = 1; \ + FFBFifo(__fpriv, 4); \ +- (__ffb)->ppc = ppc; \ +- (__ffb)->fbc = fbc; \ +- (__ffb)->rop = rop; \ ++ (__ffb)->ppc = __ppc; \ ++ (__ffb)->fbc = __fbc; \ ++ (__ffb)->rop = __rop; \ + (__ffb)->pmask = 0xffffffff; \ + (__fpriv)->rp_active = 1; \ + } \ +@@ -247,21 +247,21 @@ + unsigned int wid, unsigned int rop, unsigned int pmask); + + #define FFB_ATTR_SFB_VAR_WIN(__fpriv, __pmask, __alu, __pwin) \ +-do { unsigned int ppc = FFB_PPC_APE_DISABLE | FFB_PPC_CS_VAR | FFB_PPC_XS_WID; \ +- unsigned int ppc_mask = FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; \ +- unsigned int rop = (FFB_ROP_EDIT_BIT | (__alu))|(FFB_ROP_NEW<<8); \ +- unsigned int fbc = FFB_FBC_WIN(__pwin); \ ++do { unsigned int __ppc = FFB_PPC_APE_DISABLE | FFB_PPC_CS_VAR | FFB_PPC_XS_WID; \ ++ unsigned int __ppc_mask = FFB_PPC_APE_MASK | FFB_PPC_CS_MASK | FFB_PPC_XS_MASK; \ ++ unsigned int __rop = (FFB_ROP_EDIT_BIT | (__alu))|(FFB_ROP_NEW<<8); \ ++ unsigned int __fbc = FFB_FBC_WIN(__pwin); \ + if((__fpriv)->has_double_buffer) { \ +- fbc &= ~FFB_FBC_WB_MASK; \ +- fbc |= FFB_FBC_WB_AB; \ ++ __fbc &= ~FFB_FBC_WB_MASK; \ ++ __fbc |= FFB_FBC_WB_AB; \ + } \ +- if(((__fpriv)->ppc_cache & ppc_mask) != ppc || \ +- (__fpriv)->fbc_cache != fbc || \ ++ if(((__fpriv)->ppc_cache & __ppc_mask) != __ppc || \ ++ (__fpriv)->fbc_cache != __fbc || \ + (__fpriv)->wid_cache != FFB_WID_WIN(__pwin) || \ +- (__fpriv)->rop_cache != rop || \ ++ (__fpriv)->rop_cache != __rop || \ + (__fpriv)->pmask_cache != (__pmask)) \ +- __FFB_Attr_SFB_VAR(__fpriv, ppc, ppc_mask, fbc, \ +- FFB_WID_WIN(__pwin), rop, (__pmask)); \ ++ __FFB_Attr_SFB_VAR(__fpriv, __ppc, __ppc_mask, __fbc, \ ++ FFB_WID_WIN(__pwin), __rop, (__pmask)); \ + } while(0) + + /* VSCROLL Attributes: +@@ -277,25 +277,25 @@ + * PMASK) all options allowed + */ + #define FFB_ATTR_VSCROLL_WINCOPY(__fpriv) \ +-do { unsigned int rop = (FFB_ROP_OLD | (FFB_ROP_OLD << 8)); \ +- unsigned int fbc = FFB_FBC_WINCOPY; \ ++do { unsigned int __rop = (FFB_ROP_OLD | (FFB_ROP_OLD << 8)); \ ++ unsigned int __fbc = FFB_FBC_WINCOPY; \ + if((__fpriv)->has_double_buffer) { \ +- fbc &= ~FFB_FBC_WB_MASK; \ +- fbc |= FFB_FBC_WB_AB; \ ++ __fbc &= ~FFB_FBC_WB_MASK; \ ++ __fbc |= FFB_FBC_WB_AB; \ + } \ +- if((__fpriv)->fbc_cache != fbc || \ +- (__fpriv)->rop_cache != rop || \ ++ if((__fpriv)->fbc_cache != __fbc || \ ++ (__fpriv)->rop_cache != __rop || \ + (__fpriv)->pmask_cache != 0xffffffff || \ + (__fpriv)->drawop_cache != FFB_DRAWOP_VSCROLL) { \ + ffb_fbcPtr __ffb = (__fpriv)->regs; \ +- (__fpriv)->fbc_cache = fbc; \ +- (__fpriv)->rop_cache = rop; \ ++ (__fpriv)->fbc_cache = __fbc; \ ++ (__fpriv)->rop_cache = __rop; \ + (__fpriv)->pmask_cache = 0xffffffff; \ + (__fpriv)->drawop_cache = FFB_DRAWOP_VSCROLL; \ + (__fpriv)->rp_active = 1; \ + FFBFifo(__fpriv, 4); \ +- (__ffb)->fbc = fbc; \ +- (__ffb)->rop = rop; \ ++ (__ffb)->fbc = __fbc; \ ++ (__ffb)->rop = __rop; \ + (__ffb)->pmask = 0xffffffff; \ + (__ffb)->drawop = FFB_DRAWOP_VSCROLL; \ + (__fpriv)->rp_active = 1; \ +@@ -303,25 +303,25 @@ + } while(0) + + #define FFB_ATTR_VSCROLL_WIN(__fpriv, __pmask, __pwin) \ +-do { unsigned int rop = (FFB_ROP_OLD | (FFB_ROP_OLD << 8)); \ +- unsigned int fbc = FFB_FBC_WIN(__pwin); \ ++do { unsigned int __rop = (FFB_ROP_OLD | (FFB_ROP_OLD << 8)); \ ++ unsigned int __fbc = FFB_FBC_WIN(__pwin); \ + if((__fpriv)->has_double_buffer) { \ +- fbc &= ~FFB_FBC_WB_MASK; \ +- fbc |= FFB_FBC_WB_AB; \ ++ __fbc &= ~FFB_FBC_WB_MASK; \ ++ __fbc |= FFB_FBC_WB_AB; \ + } \ +- if((__fpriv)->fbc_cache != fbc || \ +- (__fpriv)->rop_cache != rop || \ ++ if((__fpriv)->fbc_cache != __fbc || \ ++ (__fpriv)->rop_cache != __rop || \ + (__fpriv)->pmask_cache != (__pmask) || \ + (__fpriv)->drawop_cache != FFB_DRAWOP_VSCROLL) { \ + ffb_fbcPtr __ffb = (__fpriv)->regs; \ +- (__fpriv)->fbc_cache = fbc; \ +- (__fpriv)->rop_cache = rop; \ ++ (__fpriv)->fbc_cache = __fbc; \ ++ (__fpriv)->rop_cache = __rop; \ + (__fpriv)->pmask_cache = (__pmask); \ + (__fpriv)->drawop_cache = FFB_DRAWOP_VSCROLL; \ + (__fpriv)->rp_active = 1; \ + FFBFifo(__fpriv, 4); \ +- (__ffb)->fbc = fbc; \ +- (__ffb)->rop = rop; \ ++ (__ffb)->fbc = __fbc; \ ++ (__ffb)->rop = __rop; \ + (__ffb)->pmask = (__pmask); \ + (__ffb)->drawop = FFB_DRAWOP_VSCROLL; \ + } \ +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_regs.h xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_regs.h +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_regs.h 2004-04-23 21:48:17.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_regs.h 2004-11-16 14:01:46.708984448 +0100 +@@ -432,6 +432,19 @@ + #define FFB_MER_EDRA 0x000000c0 /* Enable read-ahead, decreasing */ + #define FFB_MER_DRA 0x00000040 /* No read-ahead */ + ++/* Alpha Blend Control */ ++#define FFB_BLENDC_FORCE_ONE 0x00000010 /* Defines 0xff as 1.0 */ ++#define FFB_BLENDC_DF_MASK 0x0000000c /* Destination Frac Mask */ ++#define FFB_BLENDC_DF_ZERO 0x00000000 /* Destination Frac: 0.00 */ ++#define FFB_BLENDC_DF_ONE 0x00000004 /* Destination Frac: 1.00 */ ++#define FFB_BLENDC_DF_ONE_M_A 0x00000008 /* Destination Frac: 1.00 - Xsrc */ ++#define FFB_BLENDC_DF_A 0x0000000c /* Destination Frac: Xsrc */ ++#define FFB_BLENDC_SF_MASK 0x00000003 /* Source Frac Mask */ ++#define FFB_BLENDC_SF_ZERO 0x00000000 /* Source Frac: 0.00 */ ++#define FFB_BLENDC_SF_ONE 0x00000001 /* Source Frac: 1.00 */ ++#define FFB_BLENDC_SF_ONE_M_A 0x00000002 /* Source Frac: 1.00 - Xsrc */ ++#define FFB_BLENDC_SF_A 0x00000003 /* Source Frac: Xsrc */ ++ + /* FBram Config 0 */ + #define FFB_FBCFG0_RFTIME 0xff800000 + #define FFB_FBCFG0_XMAX 0x007c0000 +diff -ruN xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile +--- xc-old/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile 2004-06-16 11:44:00.000000000 +0200 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile 2004-11-16 14:01:46.700985664 +0100 +@@ -78,11 +78,13 @@ + INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/cfb \ +- -I$(SERVERSRC)/dbe \ ++ -I$(SERVERSRC)/dbe -I$(SERVERSRC)/fb \ ++ -I$(SERVERSRC)/render \ + -I$(XF86SRC)/xf8_32wid \ + -I$(XF86SRC)/ramdac \ + -I$(XF86SRC)/ddc \ + -I$(XF86SRC)/i2c \ ++ -I$(XF86SRC)/xaa \ + -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) \ + $(DRIINCLUDES) --- files/sunleo-conversion-2.patch- 2005-02-03 14:43:32.000000000 +0000 +++ files/sunleo-conversion-2.patch 2005-02-03 14:08:29.000000000 +0000 @@ -0,0 +1,1328 @@ +Index: Imakefile +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile 28 Sep 2004 22:56:45 -0000 +@@ -6,19 +6,19 @@ + #define IHaveModules + #include + +-SRCS = leo_driver.c leo_accel.c leo_bcopy.c leo_checks.c leo_frect.c \ +- leo_frectsp.c leo_fspans.c leo_fspanssp.c leo_gc.c leo_glyph.c \ +- leo_stubs.c leo_cursor.c +-OBJS = leo_driver.o leo_accel.o leo_bcopy.o leo_checks.o leo_frect.o \ +- leo_frectsp.o leo_fspans.o leo_fspanssp.o leo_gc.o leo_glyph.o \ +- leo_stubs.o leo_cursor.o ++SRCS = leo_driver.c leo_accel.c leo_checks.c leo_frect.c \ ++ leo_frectsp.c leo_fspans.c leo_fspanssp.c leo_glyph.c \ ++ leo_cursor.c ++OBJS = leo_driver.o leo_accel.o leo_checks.o leo_frect.o \ ++ leo_frectsp.o leo_fspans.o leo_fspanssp.o leo_glyph.o \ ++ leo_cursor.o + + #if defined(XF86DriverSDK) + INCLUDES = -I. -I../../include + #else + INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ +- -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ +- -I$(SERVERSRC)/Xext -I$(SERVERSRC)/cfb \ ++ -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ ++ -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ + -I$(XF86SRC)/ramdac \ + -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(EXTINCSRC) +Index: leo_accel.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c 28 Sep 2004 22:56:45 -0000 +@@ -30,19 +30,13 @@ + #include "mistruct.h" + #include "fontstruct.h" + #include "dixfontstr.h" +-#include "cfb.h" +-#include "cfbmskbits.h" +-#include "cfb8bit.h" ++#include "fb.h" + #include "mibstore.h" + #include "mifillarc.h" + #include "miwideline.h" +-#include "fastblt.h" +-#include "mergerop.h" +-#include "migc.h" + #include "mi.h" + + #include "leo.h" +-#include "leo_gc.h" + + int LeoScreenPrivateIndex; + int LeoGCPrivateIndex; +@@ -68,49 +62,6 @@ + LEO_ATTR_RGBE_ENABLE|LEO_ROP_ONES /* GXset */ + }; + +-static void +-LeoCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +-{ +- ScreenPtr pScreen = pWin->drawable.pScreen; +- LeoPtr pLeo = LeoGetScreenPrivate (pScreen); +- DDXPointPtr pptSrc; +- DDXPointPtr ppt; +- RegionPtr prgnDst; +- BoxPtr pbox; +- int dx, dy; +- int i, nbox; +- WindowPtr pwinRoot; +- +- if (pLeo->vtSema) +- return; +- +- dx = ptOldOrg.x - pWin->drawable.x; +- dy = ptOldOrg.y - pWin->drawable.y; +- +- pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; +- +- prgnDst = REGION_CREATE(pWin->drawable.pScreen, NULL, 1); +- +- REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); +- REGION_INTERSECT(pWin->drawable.pScreen, prgnDst, &pWin->borderClip, prgnSrc); +- +- pbox = REGION_RECTS(prgnDst); +- nbox = REGION_NUM_RECTS(prgnDst); +- if(!(pptSrc = (DDXPointPtr )ALLOCATE_LOCAL(nbox * sizeof(DDXPointRec)))) +- return; +- ppt = pptSrc; +- +- for (i = nbox; --i >= 0; ppt++, pbox++) { +- ppt->x = pbox->x1 + dx; +- ppt->y = pbox->y1 + dy; +- } +- +- LeoDoBitblt ((DrawablePtr)pwinRoot, (DrawablePtr)pwinRoot, +- GXcopy, prgnDst, pptSrc, ~0L); +- DEALLOCATE_LOCAL(pptSrc); +- REGION_DESTROY(pWin->drawable.pScreen, prgnDst); +-} +- + void LeoVtChange (ScreenPtr pScreen, int enter) + { + LeoPtr pLeo = LeoGetScreenPrivate (pScreen); +@@ -161,11 +112,7 @@ + pLeo->lc0 = lc0 = (LeoCommand0 *) ((char *)pLeo->fb + LEO_LC0_VOFF); + pLeo->ld0 = ld0 = (LeoDraw *) ((char *)pLeo->fb + LEO_LD0_VOFF); + +- if (!pLeo->NoAccel) { +- /* Replace various screen functions. */ +- pScreen->CreateGC = LeoCreateGC; +- pScreen->CopyWindow = LeoCopyWindow; +- } ++ if (!pLeo->NoAccel) /* XXX do nothing */ ; + + /* We will now clear the screen: we'll draw a rectangle covering all the + * viewscreen, using a 'blackness' ROP. +Index: leo_bcopy.c +=================================================================== +RCS file: leo_bcopy.c +diff -N xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_bcopy.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_bcopy.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ /dev/null 1 Jan 1970 00:00:00 -0000 +@@ -1,178 +0,0 @@ +-/* +- * Acceleration for the Leo (ZX) framebuffer - Bit-blit copies. +- * +- * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +- * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- */ +-/* $XFree86$ */ +- +-#define PSZ 32 +- +-#include "leo.h" +-#include "leo_regs.h" +- +-#include "pixmapstr.h" +-#include "scrnintstr.h" +- +-#include "cfb.h" +- +-void +-LeoDoBitblt(DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, +- DDXPointPtr pptSrc, unsigned long planemask) +-{ +- LeoPtr pLeo = LeoGetScreenPrivate (pDst->pScreen); +- LeoCommand0 *lc0 = pLeo->lc0; +- LeoDraw *ld0 = pLeo->ld0; +- BoxPtr pboxTmp; +- DDXPointPtr pptTmp; +- int nbox; +- BoxPtr pboxNext, pboxBase, pbox; +- +- pbox = REGION_RECTS(prgnDst); +- nbox = REGION_NUM_RECTS(prgnDst); +- +- pptTmp = pptSrc; +- pboxTmp = pbox; +- +- ld0->rop = leoRopTable[alu]; +- +- if (pptSrc->y < pbox->y1) { +- if (pptSrc->x < pbox->x1) { +- /* reverse order of bands and rects in each band */ +- pboxTmp=pbox+nbox; +- pptTmp=pptSrc+nbox; +- +- while (nbox--){ +- pboxTmp--; +- pptTmp--; +- if (pptTmp->y <= pboxTmp->y2) { +- lc0->extent = 0x80000000 | (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = (pptTmp->x + pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pptTmp->y + pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->copy = (pboxTmp->x2 - 1) | ((pboxTmp->y2 - 1) << 11); +- } else { +- lc0->extent = (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = pptTmp->x | (pptTmp->y << 11); +- lc0->copy = pboxTmp->x1 | (pboxTmp->y1 << 11); +- } +- while (lc0->csr & LEO_CSR_BLT_BUSY); +- } +- } else { +- /* keep ordering in each band, reverse order of bands */ +- pboxBase = pboxNext = pbox+nbox-1; +- +- while (pboxBase >= pbox) { /* for each band */ +- +- /* find first box in band */ +- while (pboxNext >= pbox && +- pboxBase->y1 == pboxNext->y1) +- pboxNext--; +- +- pboxTmp = pboxNext+1; /* first box in band */ +- pptTmp = pptSrc + (pboxTmp - pbox); /* first point in band */ +- +- while (pboxTmp <= pboxBase) { /* for each box in band */ +- if (pptTmp->y <= pboxTmp->y2) { +- lc0->extent = 0x80000000 | (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = (pptTmp->x + pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pptTmp->y + pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->copy = (pboxTmp->x2 - 1) | ((pboxTmp->y2 - 1) << 11); +- } else { +- lc0->extent = (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = pptTmp->x | (pptTmp->y << 11); +- lc0->copy = pboxTmp->x1 | (pboxTmp->y1 << 11); +- } +- while (lc0->csr & LEO_CSR_BLT_BUSY); +- ++pboxTmp; +- ++pptTmp; +- } +- pboxBase = pboxNext; +- +- } +- } +- } else { +- if (pptSrc->x < pbox->x1) { +- /* reverse order of rects in each band */ +- +- pboxBase = pboxNext = pbox; +- +- while (pboxBase < pbox+nbox) { /* for each band */ +- +- /* find last box in band */ +- while (pboxNext < pbox+nbox && +- pboxNext->y1 == pboxBase->y1) +- pboxNext++; +- +- pboxTmp = pboxNext; /* last box in band */ +- pptTmp = pptSrc + (pboxTmp - pbox); /* last point in band */ +- +- if (pptSrc->y == pbox->y1) { +- while (pboxTmp != pboxBase) { /* for each box in band */ +- --pboxTmp; +- --pptTmp; +- lc0->extent = 0x80000000 | (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = (pptTmp->x + pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pptTmp->y + pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->copy = (pboxTmp->x2 - 1) | ((pboxTmp->y2 - 1) << 11); +- while (lc0->csr & LEO_CSR_BLT_BUSY); +- } +- } else { +- while (pboxTmp != pboxBase) { /* for each box in band */ +- --pboxTmp; +- --pptTmp; +- lc0->extent = (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = pptTmp->x | (pptTmp->y << 11); +- lc0->copy = pboxTmp->x1 | (pboxTmp->y1 << 11); +- while (lc0->csr & LEO_CSR_BLT_BUSY); +- } +- } +- pboxBase = pboxNext; +- } +- } else { +- while (nbox--) { +- lc0->extent = (pboxTmp->x2 - pboxTmp->x1 - 1) | +- ((pboxTmp->y2 - pboxTmp->y1 - 1) << 11); +- lc0->src = pptTmp->x | (pptTmp->y << 11); +- lc0->copy = pboxTmp->x1 | (pboxTmp->y1 << 11); +- while (lc0->csr & LEO_CSR_BLT_BUSY); +- pboxTmp++; +- pptTmp++; +- } +- } +- } +- +- ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; +-} +- +-RegionPtr +-LeoCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, +- GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) +-{ +- if (pSrcDrawable->type != DRAWABLE_WINDOW) +- return cfbCopyArea (pSrcDrawable, pDstDrawable, +- pGC, srcx, srcy, width, height, dstx, dsty); +- return cfbBitBlt (pSrcDrawable, pDstDrawable, +- pGC, srcx, srcy, width, height, dstx, dsty, (void (*)())LeoDoBitblt, 0); +-} +Index: leo_checks.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_checks.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_checks.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_checks.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_checks.c 28 Sep 2004 22:56:45 -0000 +@@ -29,7 +29,7 @@ + #include "pixmapstr.h" + #include "scrnintstr.h" + +-#include "cfb.h" ++#include "fb.h" + + int + LeoCheckTile (PixmapPtr pPixmap, LeoStipplePtr stipple, int ox, int oy) +Index: leo_driver.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c 28 Sep 2004 22:56:45 -0000 +@@ -31,9 +31,7 @@ + #include "mibstore.h" + #include "micmap.h" + +-#define PSZ 32 +-#include "cfb.h" +-#undef PSZ ++#include "fb.h" + #include "xf86cmap.h" + #include "leo.h" + +@@ -414,7 +412,7 @@ + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + } + +- if (xf86LoadSubModule(pScrn, "cfb32") == NULL) { ++ if (xf86LoadSubModule(pScrn, "fb") == NULL) { + LeoFreeRec(pScrn); + return FALSE; + } +@@ -502,9 +500,9 @@ + * pScreen fields. + */ + +- ret = cfb32ScreenInit(pScreen, pLeo->fb, pScrn->virtualX, +- pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, +- 2048); ++ ret = fbScreenInit(pScreen, pLeo->fb, pScrn->virtualX, ++ pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, ++ 2048, pScrn->bitsPerPixel); + if (!ret) + return FALSE; + +Index: leo_frect.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frect.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frect.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frect.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frect.c 28 Sep 2004 22:56:45 -0000 +@@ -30,8 +30,7 @@ + #include "pixmapstr.h" + #include "scrnintstr.h" + +-#include "cfb.h" +-#include "cfbmskbits.h" ++#include "fb.h" + + void + LeoPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit) +@@ -50,7 +49,7 @@ + if(nrectFill <= 0) + return; + +- prgnClip = cfbGetCompositeClip(pGC); ++ prgnClip = fbGetCompositeClip(pGC); + + prect = prectInit; + xorg = pDrawable->x; +@@ -178,7 +177,7 @@ + if(nrectFill <= 0) + return; + +- prgnClip = cfbGetCompositeClip(pGC); ++ prgnClip = fbGetCompositeClip(pGC); + + prect = prectInit; + xorg = pDrawable->x; +Index: leo_frectsp.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frectsp.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frectsp.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frectsp.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_frectsp.c 28 Sep 2004 22:56:45 -0000 +@@ -30,8 +30,7 @@ + #include "pixmapstr.h" + #include "scrnintstr.h" + +-#include "cfb.h" +-#include "cfbmskbits.h" ++#include "fb.h" + + void + LeoPolyFillStippledRect(DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle *prectInit) +@@ -53,7 +52,7 @@ + if(nrectFill <= 0) + return; + +- prgnClip = cfbGetCompositeClip(pGC); ++ prgnClip = fbGetCompositeClip(pGC); + + prect = prectInit; + xorg = pDrawable->x; +Index: leo_fspans.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspans.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspans.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspans.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspans.c 28 Sep 2004 22:56:45 -0000 +@@ -29,7 +29,7 @@ + #include "pixmapstr.h" + #include "scrnintstr.h" + +-#include "cfb.h" ++#include "fb.h" + #include "mi.h" + #include "mispans.h" + +@@ -48,7 +48,7 @@ + int fg; + int cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0; + +- clip = cfbGetCompositeClip(pGC); ++ clip = fbGetCompositeClip(pGC); + numRects = REGION_NUM_RECTS(clip); + + if (!numRects) +Index: leo_fspanssp.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspanssp.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspanssp.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspanssp.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_fspanssp.c 28 Sep 2004 22:56:45 -0000 +@@ -29,7 +29,7 @@ + #include "pixmapstr.h" + #include "scrnintstr.h" + +-#include "cfb.h" ++#include "fb.h" + #include "mi.h" + #include "mispans.h" + +@@ -49,7 +49,7 @@ + unsigned int *bits, msk; + int cx1 = 0, cy1 = 0, cx2 = 0, cy2 = 0; + +- clip = cfbGetCompositeClip(pGC); ++ clip = fbGetCompositeClip(pGC); + numRects = REGION_NUM_RECTS(clip); + + if (!numRects) +Index: leo_gc.c +=================================================================== +RCS file: leo_gc.c +diff -N xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ /dev/null 1 Jan 1970 00:00:00 -0000 +@@ -1,592 +0,0 @@ +-/* +- * Acceleration for the Leo (ZX) framebuffer - GC implementation. +- * +- * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com) +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +- * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- */ +-/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.c,v 1.1 2000/05/18 23:21:40 dawes Exp $ */ +- +-#define PSZ 32 +- +-#include "leo.h" +-#include "leo_regs.h" +-#include "leo_gc.h" +- +-#include "X.h" +-#include "Xmd.h" +-#include "Xproto.h" +-#include "cfb.h" +-#include "fontstruct.h" +-#include "dixfontstr.h" +-#include "gcstruct.h" +-#include "windowstr.h" +-#include "pixmapstr.h" +-#include "scrnintstr.h" +-#include "region.h" +- +-#include "mistruct.h" +-#include "mibstore.h" +-#include "migc.h" +- +-#include "cfbmskbits.h" +-#include "cfb8bit.h" +- +-void LeoValidateGC(GCPtr, unsigned long, DrawablePtr); +-static void LeoDestroyGC(GCPtr); +- +-GCFuncs LeoGCFuncs = { +- LeoValidateGC, +- miChangeGC, +- miCopyGC, +- LeoDestroyGC, +- miChangeClip, +- miDestroyClip, +- miCopyClip, +-}; +- +-GCOps LeoTEOps1Rect = { +- cfbSolidSpansCopy, +- cfbSetSpans, +- cfbPutImage, +- LeoCopyArea, +- cfbCopyPlane, +- cfbPolyPoint, +- cfb8LineSS1Rect, +- cfb8SegmentSS1Rect, +- miPolyRectangle, +- cfbZeroPolyArcSS8Copy, +- cfbFillPoly1RectCopy, +- LeoPolyFillRect1Rect, +- cfbPolyFillArcSolidCopy, +- miPolyText8, +- miPolyText16, +- miImageText8, +- miImageText16, +- LeoTEGlyphBlt, +- LeoPolyTEGlyphBlt, +- mfbPushPixels +-#ifdef NEED_LINEHELPER +- ,NULL +-#endif +-}; +- +-GCOps LeoNonTEOps1Rect = { +- cfbSolidSpansCopy, +- cfbSetSpans, +- cfbPutImage, +- LeoCopyArea, +- cfbCopyPlane, +- cfbPolyPoint, +- cfb8LineSS1Rect, +- cfb8SegmentSS1Rect, +- miPolyRectangle, +- cfbZeroPolyArcSS8Copy, +- cfbFillPoly1RectCopy, +- LeoPolyFillRect1Rect, +- cfbPolyFillArcSolidCopy, +- miPolyText8, +- miPolyText16, +- miImageText8, +- miImageText16, +- cfbImageGlyphBlt8, +- LeoPolyGlyphBlt, +- mfbPushPixels +-#ifdef NEED_LINEHELPER +- ,NULL +-#endif +-}; +- +-GCOps LeoTEOps = { +- cfbSolidSpansCopy, +- cfbSetSpans, +- cfbPutImage, +- LeoCopyArea, +- cfbCopyPlane, +- cfbPolyPoint, +- cfbLineSS, +- cfbSegmentSS, +- miPolyRectangle, +- cfbZeroPolyArcSS8Copy, +- miFillPolygon, +- LeoPolyFillRect, +- cfbPolyFillArcSolidCopy, +- miPolyText8, +- miPolyText16, +- miImageText8, +- miImageText16, +- LeoTEGlyphBlt, +- LeoPolyTEGlyphBlt, +- mfbPushPixels +-#ifdef NEED_LINEHELPER +- ,NULL +-#endif +-}; +- +-GCOps LeoNonTEOps = { +- cfbSolidSpansCopy, +- cfbSetSpans, +- cfbPutImage, +- LeoCopyArea, +- cfbCopyPlane, +- cfbPolyPoint, +- cfbLineSS, +- cfbSegmentSS, +- miPolyRectangle, +- cfbZeroPolyArcSS8Copy, +- miFillPolygon, +- LeoPolyFillRect, +- cfbPolyFillArcSolidCopy, +- miPolyText8, +- miPolyText16, +- miImageText8, +- miImageText16, +- cfbImageGlyphBlt8, +- LeoPolyGlyphBlt, +- mfbPushPixels +-#ifdef NEED_LINEHELPER +- ,NULL +-#endif +-}; +- +-GCOps * +-LeoMatchCommon (GCPtr pGC, cfbPrivGCPtr devPriv) +-{ +- if (pGC->lineWidth != 0) +- return 0; +- if (pGC->lineStyle != LineSolid) +- return 0; +- if (pGC->fillStyle != FillSolid) +- return 0; +- if (devPriv->rop != GXcopy) +- return 0; +- if (pGC->font && +- FONTMAXBOUNDS(pGC->font,rightSideBearing) - +- FONTMINBOUNDS(pGC->font,leftSideBearing) <= 32 && +- FONTMINBOUNDS(pGC->font,characterWidth) >= 0) { +- if (TERMINALFONT(pGC->font)) +- if (devPriv->oneRect) +- return &LeoTEOps1Rect; +- else +- return &LeoTEOps; +- else +- if (devPriv->oneRect) +- return &LeoNonTEOps1Rect; +- else +- return &LeoNonTEOps; +- } +- return 0; +-} +- +-Bool +-LeoCreateGC(GCPtr pGC) +-{ +- LeoPrivGCPtr gcPriv; +- +- if (pGC->depth == 1) +- return mfbCreateGC (pGC); +- if (!cfbCreateGC (pGC)) +- return FALSE; +- +- pGC->ops = & LeoNonTEOps; +- pGC->funcs = & LeoGCFuncs; +- gcPriv = LeoGetGCPrivate (pGC); +- gcPriv->type = DRAWABLE_WINDOW; +- gcPriv->stipple = 0; +- return TRUE; +-} +- +-static void +-LeoDestroyGC (GCPtr pGC) +-{ +- LeoPrivGCPtr gcPriv = LeoGetGCPrivate (pGC); +- +- if (gcPriv->stipple) +- xfree (gcPriv->stipple); +- miDestroyGC (pGC); +-} +- +-void +-LeoValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) +-{ +- int mask; +- int index; +- int new_rrop; +- int new_line, new_text, new_fillspans, new_fillarea; +- int new_rotate; +- int xrot, yrot; +- /* flags for changing the proc vector */ +- LeoPrivGCPtr gcPriv; +- cfbPrivGCPtr devPriv; +- int oneRect, type; +- LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen); +- +- gcPriv = LeoGetGCPrivate (pGC); +- type = pLeo->vtSema ? -1 : pDrawable->type; +- if (type != DRAWABLE_WINDOW) { +- if (gcPriv->type == DRAWABLE_WINDOW) { +- extern GCOps cfbNonTEOps; +- +- miDestroyGCOps (pGC->ops); +- pGC->ops = &cfbNonTEOps; +- changes = (1 << (GCLastBit+1)) - 1; +- pGC->stateChanges = changes; +- gcPriv->type = type; +- } +- cfbValidateGC (pGC, changes, pDrawable); +- return; +- } +- +- if (gcPriv->type != DRAWABLE_WINDOW) { +- changes = (1 << (GCLastBit+1)) - 1; +- gcPriv->type = DRAWABLE_WINDOW; +- } +- +- new_rotate = pGC->lastWinOrg.x != pDrawable->x || +- pGC->lastWinOrg.y != pDrawable->y; +- +- pGC->lastWinOrg.x = pDrawable->x; +- pGC->lastWinOrg.y = pDrawable->y; +- devPriv = cfbGetGCPrivate(pGC); +- +- new_rrop = FALSE; +- new_line = FALSE; +- new_text = FALSE; +- new_fillspans = FALSE; +- new_fillarea = FALSE; +- +- /* +- * if the client clip is different or moved OR the subwindowMode has +- * changed OR the window's clip has changed since the last validation +- * we need to recompute the composite clip +- */ +- +- if ((changes & (GCClipXOrigin|GCClipYOrigin|GCClipMask|GCSubwindowMode)) || +- (pDrawable->serialNumber != (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { +- miComputeCompositeClip (pGC, pDrawable); +- oneRect = REGION_NUM_RECTS(cfbGetCompositeClip(pGC)) == 1; +- if (oneRect != devPriv->oneRect) +- new_line = TRUE; +- devPriv->oneRect = oneRect; +- } +- +- mask = changes; +- while (mask) { +- index = lowbit (mask); +- mask &= ~index; +- +- /* +- * this switch acculmulates a list of which procedures might have +- * to change due to changes in the GC. in some cases (e.g. +- * changing one 16 bit tile for another) we might not really need +- * a change, but the code is being paranoid. this sort of batching +- * wins if, for example, the alu and the font have been changed, +- * or any other pair of items that both change the same thing. +- */ +- switch (index) { +- case GCFunction: +- case GCForeground: +- new_rrop = TRUE; +- break; +- case GCPlaneMask: +- new_rrop = TRUE; +- new_text = TRUE; +- break; +- case GCBackground: +- break; +- case GCLineStyle: +- case GCLineWidth: +- new_line = TRUE; +- break; +- case GCJoinStyle: +- case GCCapStyle: +- break; +- case GCFillStyle: +- new_text = TRUE; +- new_fillspans = TRUE; +- new_line = TRUE; +- new_fillarea = TRUE; +- break; +- case GCFillRule: +- break; +- case GCTile: +- new_fillspans = TRUE; +- new_fillarea = TRUE; +- break; +- +- case GCStipple: +- if (pGC->stipple) { +- int width = pGC->stipple->drawable.width; +- PixmapPtr nstipple; +- +- if ((width <= PGSZ) && !(width & (width - 1)) && +- (nstipple = cfbCopyPixmap(pGC->stipple))) { +- cfbPadPixmap(nstipple); +- (*pGC->pScreen->DestroyPixmap)(pGC->stipple); +- pGC->stipple = nstipple; +- } +- } +- new_fillspans = TRUE; +- new_fillarea = TRUE; +- break; +- +- case GCTileStipXOrigin: +- new_rotate = TRUE; +- break; +- +- case GCTileStipYOrigin: +- new_rotate = TRUE; +- break; +- +- case GCFont: +- new_text = TRUE; +- break; +- case GCSubwindowMode: +- break; +- case GCGraphicsExposures: +- break; +- case GCClipXOrigin: +- break; +- case GCClipYOrigin: +- break; +- case GCClipMask: +- break; +- case GCDashOffset: +- break; +- case GCDashList: +- break; +- case GCArcMode: +- break; +- default: +- break; +- } +- } +- +- /* +- * If the drawable has changed, ensure suitable +- * entries are in the proc vector. +- */ +- if (pDrawable->serialNumber != (pGC->serialNumber & (DRAWABLE_SERIAL_BITS))) { +- new_fillspans = TRUE; /* deal with FillSpans later */ +- } +- +- if (new_rotate || new_fillspans) { +- Bool new_pix = FALSE; +- +- xrot = pGC->patOrg.x + pDrawable->x; +- yrot = pGC->patOrg.y + pDrawable->y; +- +- LeoCheckFill (pGC, pDrawable); +- +- switch (pGC->fillStyle) { +- case FillTiled: +- if (!pGC->tileIsPixel) { +- int width = pGC->tile.pixmap->drawable.width * PSZ; +- +- if ((width <= 32) && !(width & (width - 1))) { +- cfbCopyRotatePixmap(pGC->tile.pixmap, +- &pGC->pRotatedPixmap, +- xrot, yrot); +- new_pix = TRUE; +- } +- } +- break; +- } +- +- if (!new_pix && pGC->pRotatedPixmap) { +- (*pGC->pScreen->DestroyPixmap)(pGC->pRotatedPixmap); +- pGC->pRotatedPixmap = (PixmapPtr) NULL; +- } +- } +- +- if (new_rrop) { +- int old_rrop; +- +- if (gcPriv->stipple) { +- if (pGC->fillStyle == FillStippled) +- gcPriv->stipple->alu = pGC->alu | 0x80; +- else +- gcPriv->stipple->alu = pGC->alu; +- if (pGC->fillStyle != FillTiled) { +- gcPriv->stipple->fg = pGC->fgPixel; +- gcPriv->stipple->bg = pGC->bgPixel; +- } +- } +- +- old_rrop = devPriv->rop; +- devPriv->rop = cfbReduceRasterOp (pGC->alu, pGC->fgPixel, +- pGC->planemask, +- &devPriv->and, &devPriv->xor); +- if (old_rrop == devPriv->rop) +- new_rrop = FALSE; +- else { +- new_line = TRUE; +- new_text = TRUE; +- new_fillspans = TRUE; +- new_fillarea = TRUE; +- } +- } +- +- if (new_rrop || new_fillspans || new_text || new_fillarea || new_line) { +- GCOps *newops; +- +- if ((newops = LeoMatchCommon (pGC, devPriv)) != NULL) { +- if (pGC->ops->devPrivate.val) +- miDestroyGCOps (pGC->ops); +- pGC->ops = newops; +- new_rrop = new_line = new_fillspans = new_text = new_fillarea = 0; +- } else { +- if (!pGC->ops->devPrivate.val) { +- pGC->ops = miCreateGCOps (pGC->ops); +- pGC->ops->devPrivate.val = 1; +- } +- pGC->ops->CopyArea = LeoCopyArea; +- } +- } +- +- /* deal with the changes we've collected */ +- if (new_line) { +- pGC->ops->FillPolygon = miFillPolygon; +- if (devPriv->oneRect && pGC->fillStyle == FillSolid) { +- switch (devPriv->rop) { +- case GXcopy: +- pGC->ops->FillPolygon = cfbFillPoly1RectCopy; +- break; +- default: +- pGC->ops->FillPolygon = LeoFillPoly1RectGeneral; +- break; +- } +- } +- if (pGC->lineWidth == 0) { +- if ((pGC->lineStyle == LineSolid) && (pGC->fillStyle == FillSolid)) { +- switch (devPriv->rop) { +- case GXcopy: +- pGC->ops->PolyArc = cfbZeroPolyArcSS8Copy; +- break; +- default: +- pGC->ops->PolyArc = LeoZeroPolyArcSS8General; +- break; +- } +- } else +- pGC->ops->PolyArc = miZeroPolyArc; +- } else +- pGC->ops->PolyArc = miPolyArc; +- pGC->ops->PolySegment = miPolySegment; +- switch (pGC->lineStyle) { +- case LineSolid: +- if(pGC->lineWidth == 0) { +- if (pGC->fillStyle == FillSolid) { +- if (devPriv->oneRect && +- ((pDrawable->x >= pGC->pScreen->width - 32768) && +- (pDrawable->y >= pGC->pScreen->height - 32768))) { +- pGC->ops->Polylines = cfb8LineSS1Rect; +- pGC->ops->PolySegment = cfb8SegmentSS1Rect; +- } else { +- pGC->ops->Polylines = cfbLineSS; +- pGC->ops->PolySegment = cfbSegmentSS; +- } +- } else +- pGC->ops->Polylines = miZeroLine; +- } else +- pGC->ops->Polylines = miWideLine; +- break; +- case LineOnOffDash: +- case LineDoubleDash: +- if (pGC->lineWidth == 0 && pGC->fillStyle == FillSolid) { +- pGC->ops->Polylines = cfbLineSD; +- pGC->ops->PolySegment = cfbSegmentSD; +- } else +- pGC->ops->Polylines = miWideDash; +- break; +- } +- } +- +- if (new_text && pGC->font) { +- if (FONTMAXBOUNDS(pGC->font,rightSideBearing) - +- FONTMINBOUNDS(pGC->font,leftSideBearing) > 32 || +- FONTMINBOUNDS(pGC->font,characterWidth) < 0) { +- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; +- pGC->ops->ImageGlyphBlt = miImageGlyphBlt; +- } else { +- if (pGC->fillStyle == FillSolid) { +- if (TERMINALFONT (pGC->font)) +- pGC->ops->PolyGlyphBlt = LeoPolyTEGlyphBlt; +- else +- pGC->ops->PolyGlyphBlt = LeoPolyGlyphBlt; +- } else +- pGC->ops->PolyGlyphBlt = miPolyGlyphBlt; +- +- /* special case ImageGlyphBlt for terminal emulator fonts */ +- if (TERMINALFONT (pGC->font)) +- pGC->ops->ImageGlyphBlt = LeoTEGlyphBlt; +- else +- pGC->ops->ImageGlyphBlt = miImageGlyphBlt; +- } +- } +- +- if (new_fillspans) { +- switch (pGC->fillStyle) { +- case FillSolid: +- pGC->ops->FillSpans = LeoFillSpansSolid; +- break; +- case FillTiled: +- if (pGC->pRotatedPixmap) { +- if (pGC->alu == GXcopy && (pGC->planemask & PMSK) == PMSK) +- pGC->ops->FillSpans = cfbTile32FSCopy; +- else +- pGC->ops->FillSpans = LeoTile32FSGeneral; +- } else +- pGC->ops->FillSpans = cfbUnnaturalTileFS; +- break; +- case FillStippled: +- pGC->ops->FillSpans = cfbUnnaturalStippleFS; +- break; +- case FillOpaqueStippled: +- pGC->ops->FillSpans = cfbUnnaturalStippleFS; +- break; +- default: +- FatalError("LeoValidateGC: illegal fillStyle\n"); +- } +- if (gcPriv->stipple) +- pGC->ops->FillSpans = LeoFillSpansStippled; +- } /* end of new_fillspans */ +- +- if (new_fillarea) { +- pGC->ops->PolyFillRect = miPolyFillRect; +- if (pGC->fillStyle == FillSolid) { +- if (devPriv->oneRect) +- pGC->ops->PolyFillRect = LeoPolyFillRect1Rect; +- else +- pGC->ops->PolyFillRect = LeoPolyFillRect; +- } else if (gcPriv->stipple) +- pGC->ops->PolyFillRect = LeoPolyFillStippledRect; +- else if (pGC->fillStyle == FillTiled) +- pGC->ops->PolyFillRect = cfbPolyFillRect; +- pGC->ops->PolyFillArc = miPolyFillArc; +- if (pGC->fillStyle == FillSolid) { +- switch (devPriv->rop) { +- case GXcopy: +- pGC->ops->PolyFillArc = cfbPolyFillArcSolidCopy; +- break; +- default: +- pGC->ops->PolyFillArc = LeoPolyFillArcSolidGeneral; +- break; +- } +- } +- } +-} +Index: leo_gc.h +=================================================================== +RCS file: leo_gc.h +diff -N xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.h +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_gc.h 23 Apr 2004 19:48:50 -0000 1.2 ++++ /dev/null 1 Jan 1970 00:00:00 -0000 +@@ -1,81 +0,0 @@ +-/* +- * Acceleration for the Leo (ZX) framebuffer - Accel func declarations. +- * +- * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +- * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- */ +-/* $XFree86$ */ +- +-#ifndef LEOGC_H +-#define LEOGC_H +- +-extern RegionPtr LeoCopyArea(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, +- GCPtr pGC, int srcx, int srcy, int width, int height, +- int dstx, int dsty); +- +-extern RegionPtr LeoCopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, +- GCPtr pGC, int srcx, int srcy, int width, int height, +- int dstx, int dsty, unsigned long bitPlane); +- +-extern void LeoFillBoxSolid (DrawablePtr pDrawable, int nBox, +- BoxPtr pBox, unsigned long pixel); +- +-extern void LeoPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, +- int nrectFill, xRectangle *prectInit); +- +-extern void LeoPolyFillRect1Rect(DrawablePtr pDrawable, register GCPtr pGC, +- int nrectFill, xRectangle *prectInit); +- +-extern void LeoPolyFillStippledRect(DrawablePtr pDrawable, GCPtr pGC, +- int nrectFill, xRectangle *prectInit); +- +-extern void LeoFillSpansSolid (DrawablePtr pDrawable, GCPtr pGC, +- int n, DDXPointPtr ppt, +- int *pwidth, int fSorted); +- +-extern void LeoFillSpansStippled (DrawablePtr pDrawable, GCPtr pGC, +- int n, DDXPointPtr ppt, +- int *pwidth, int fSorted); +- +-extern void LeoPolyGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, +- unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); +- +-extern void LeoTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, +- unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); +- +-extern void LeoPolyTEGlyphBlt (DrawablePtr pDrawable, GCPtr pGC, int x, int y, +- unsigned int nglyph, CharInfoPtr *ppci, pointer pGlyphBase); +- +-extern void LeoFillPoly1RectGeneral(DrawablePtr pDrawable, GCPtr pGC, int shape, +- int mode, int count, DDXPointPtr ptsIn); +- +-extern void LeoZeroPolyArcSS8General(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs); +- +-extern void LeoTile32FSGeneral(DrawablePtr pDrawable, GCPtr pGC, int nInit, +- DDXPointPtr pptInit, int *pwidthInit, int fSorted); +- +-extern void LeoPolyFillArcSolidGeneral(DrawablePtr pDrawable, GCPtr pGC, +- int narcs, xArc *parcs); +- +-extern int LeoCheckFill (GCPtr pGC, DrawablePtr pDrawable); +- +-extern void LeoDoBitblt (DrawablePtr pSrc, DrawablePtr pDst, int alu, RegionPtr prgnDst, +- DDXPointPtr pptSrc, unsigned long planemask); +- +-#endif /* LEOGC_H */ +Index: leo_glyph.c +=================================================================== +RCS file: /cvs/xorg/xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_glyph.c,v +retrieving revision 1.2 +diff -u -r1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_glyph.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_glyph.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_glyph.c 28 Sep 2004 22:56:45 -0000 +@@ -31,7 +31,7 @@ + #include "fontstruct.h" + #include "dixfontstr.h" + +-#include "cfb.h" ++#include "fb.h" + #include "mi.h" + + void +@@ -51,7 +51,7 @@ + unsigned char *fb; + int height, width; + +- clip = cfbGetCompositeClip(pGC); ++ clip = fbGetCompositeClip(pGC); + /* compute an approximate (but covering) bounding box */ + box.x1 = 0; + if (ppci[0]->metrics.leftSideBearing < 0) +@@ -76,7 +76,7 @@ + ld0->vclipmax = ((clip->extents.y2 - 1) << 16) | (clip->extents.x2 - 1); + break; + } +- cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, pGlyphBase); ++ fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, pGlyphBase); + case rgnOUT: + return; + default: +@@ -178,7 +178,7 @@ + + widthGlyph = FONTMAXBOUNDS(pfont,characterWidth); + h = FONTASCENT(pfont) + FONTDESCENT(pfont); +- clip = cfbGetCompositeClip(pGC); ++ clip = fbGetCompositeClip(pGC); + bbox.x1 = x + pDrawable->x; + bbox.x2 = bbox.x1 + (widthGlyph * nglyph); + bbox.y1 = y + pDrawable->y - FONTASCENT(pfont); +@@ -205,7 +205,7 @@ + x -= pDrawable->x; + y = y - pDrawable->y + FONTASCENT(pfont); + if (pGlyphBase) +- cfbPolyGlyphBlt8 (pDrawable, pGC, x, y, nglyph, ppci, NULL); ++ fbPolyGlyphBlt (pDrawable, pGC, x, y, nglyph, ppci, NULL); + else + miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pGlyphBase); + case rgnOUT: +Index: leo_stubs.c +=================================================================== +RCS file: leo_stubs.c +diff -N xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_stubs.c +--- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_stubs.c 23 Apr 2004 19:48:50 -0000 1.2 ++++ /dev/null 1 Jan 1970 00:00:00 -0000 +@@ -1,104 +0,0 @@ +-/* +- * Acceleration for the Leo (ZX) framebuffer - Unaccelerated stuff. +- * +- * Copyright (C) 1999 Jakub Jelinek (jakub@redhat.com) +- * +- * Permission is hereby granted, free of charge, to any person obtaining a copy +- * of this software and associated documentation files (the "Software"), to deal +- * in the Software without restriction, including without limitation the rights +- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +- * copies of the Software, and to permit persons to whom the Software is +- * furnished to do so, subject to the following conditions: +- * +- * The above copyright notice and this permission notice shall be included in +- * all copies or substantial portions of the Software. +- * +- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +- * JAKUB JELINEK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +- * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +- * +- */ +-/* $XFree86$ */ +- +-#define PSZ 32 +- +-#include "leo.h" +- +-#include "pixmapstr.h" +-#include "scrnintstr.h" +- +-#include "cfb.h" +- +-void +-LeoFillPoly1RectGeneral(DrawablePtr pDrawable, GCPtr pGC, int shape, +- int mode, int count, DDXPointPtr ptsIn) +-{ +- LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen); +- LeoDraw *ld0 = pLeo->ld0; +- +- if (pGC->alu != GXcopy) +- ld0->rop = leoRopTable[pGC->alu]; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = pGC->planemask; +- cfbFillPoly1RectCopy(pDrawable, pGC, shape, mode, count, ptsIn); +- if (pGC->alu != GXcopy) +- ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = 0xffffff; +-} +- +-void +-LeoZeroPolyArcSS8General(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc *parcs) +-{ +- LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen); +- LeoDraw *ld0 = pLeo->ld0; +- +- if (pGC->alu != GXcopy) +- ld0->rop = leoRopTable[pGC->alu]; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = pGC->planemask; +- cfbZeroPolyArcSS8Copy(pDrawable, pGC, narcs, parcs); +- if (pGC->alu != GXcopy) +- ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = 0xffffff; +-} +- +-void +-LeoTile32FSGeneral(DrawablePtr pDrawable, GCPtr pGC, int nInit, +- DDXPointPtr pptInit, int *pwidthInit, int fSorted) +-{ +- LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen); +- LeoDraw *ld0 = pLeo->ld0; +- +- if (pGC->alu != GXcopy) +- ld0->rop = leoRopTable[pGC->alu]; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = pGC->planemask; +- cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted); +- if (pGC->alu != GXcopy) +- ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = 0xffffff; +-} +- +-void +-LeoPolyFillArcSolidGeneral(DrawablePtr pDrawable, GCPtr pGC, +- int narcs, xArc *parcs) +-{ +- LeoPtr pLeo = LeoGetScreenPrivate (pDrawable->pScreen); +- LeoDraw *ld0 = pLeo->ld0; +- +- if (pGC->alu != GXcopy) +- ld0->rop = leoRopTable[pGC->alu]; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = pGC->planemask; +- cfbPolyFillArcSolidCopy(pDrawable, pGC, narcs, parcs); +- if (pGC->alu != GXcopy) +- ld0->rop = LEO_ATTR_RGBE_ENABLE|LEO_ROP_NEW; +- if (pGC->planemask != 0xffffff) +- ld0->planemask = 0xffffff; +-} --- xorg-x11-6.8.2-r3.ebuild- 2005-06-12 17:52:00.000000000 +0000 +++ xorg-x11-6.8.2-r3.ebuild 2005-06-12 17:52:00.000000000 +0000 @@ -493,6 +493,10 @@ cd ${WORKDIR} EPATCH_SUFFIX="patch" \ epatch ${PATCHDIR} + einfo "Apply sunleo patch" + epatch ${FILESDIR}/sunleo-conversion-2.patch + einfo "Apply sunffb xaa patch" + epatch ${FILESDIR}/092_Xserver_sunffb_xaa_extension.diff cd ${S} }