#include "ffb.h"
#include "ffb_regs.h"
#include "ffb_rcache.h"
#include "ffb_fifo.h"
#include "pixmapstr.h"
#include "scrnintstr.h"
#define PSZ 8
#include "cfb.h"
#undef PSZ
#include "cfb32.h"
#undef USE_SFB_TRICKS
#ifdef USE_SFB_TRICKS
struct cfb_gcstate {
unsigned long pmask;
int alu, rop, and, xor;
};
#define CFB_STATE_SAVE(__statep, __gcp, __privp) \
do { (__statep)->pmask = (__gcp)->planemask; \
(__statep)->alu = (__gcp)->alu; \
(__statep)->rop = (__privp)->rop; \
(__statep)->and = (__privp)->and; \
(__statep)->xor = (__privp)->xor; \
} while(0)
#define CFB_STATE_RESTORE(__statep, __gcp, __privp) \
do { (__gcp)->planemask = (__statep)->pmask; \
(__gcp)->alu = (__statep)->alu; \
(__privp)->rop = (__statep)->rop; \
(__privp)->and = (__statep)->and; \
(__privp)->xor = (__statep)->xor; \
} while(0)
#define CFB_STATE_SET_SFB(__gcp, __privp) \
do { (__gcp)->alu = GXcopy; \
(__gcp)->planemask = (((__gcp)->depth==8)?0xff:0xffffff); \
(__privp)->rop = GXcopy; \
(__privp)->and = 0; \
(__privp)->xor = (__gcp)->fgPixel; \
} while(0)
#endif
void
CreatorSolidSpansGeneralStub (DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbSolidSpansGeneral(pDrawable, pGC, nInit, pptInit,
pwidthInit, fSorted);
else
cfb32SolidSpansGeneral(pDrawable, pGC, nInit, pptInit,
pwidthInit, fSorted);
}
void
CreatorSegmentSSStub (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8) {
if (devPriv->oneRect &&
((pDrawable->x >= pGC->pScreen->width - 32768) &&
(pDrawable->y >= pGC->pScreen->height - 32768)))
cfb8SegmentSS1Rect(pDrawable, pGC, nseg, pSeg);
else
cfbSegmentSS(pDrawable, pGC, nseg, pSeg);
} else
cfb32SegmentSS(pDrawable, pGC, nseg, pSeg);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8) {
if (devPriv->oneRect &&
((pDrawable->x >= pGC->pScreen->width - 32768) &&
(pDrawable->y >= pGC->pScreen->height - 32768)))
cfb8SegmentSS1Rect(pDrawable, pGC, nseg, pSeg);
else
cfbSegmentSS(pDrawable, pGC, nseg, pSeg);
} else
cfb32SegmentSS(pDrawable, pGC, nseg, pSeg);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorLineSSStub (DrawablePtr pDrawable, GCPtr pGC,
int mode, int npt, DDXPointPtr ppt)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8) {
if (devPriv->oneRect &&
((pDrawable->x >= pGC->pScreen->width - 32768) &&
(pDrawable->y >= pGC->pScreen->height - 32768)))
cfb8LineSS1Rect(pDrawable, pGC, mode, npt, ppt);
else
cfbLineSS(pDrawable, pGC, mode, npt, ppt);
} else
cfb32LineSS(pDrawable, pGC, mode, npt, ppt);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8) {
if (devPriv->oneRect &&
((pDrawable->x >= pGC->pScreen->width - 32768) &&
(pDrawable->y >= pGC->pScreen->height - 32768)))
cfb8LineSS1Rect(pDrawable, pGC, mode, npt, ppt);
else
cfbLineSS(pDrawable, pGC, mode, npt, ppt);
} else
cfb32LineSS(pDrawable, pGC, mode, npt, ppt);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorSegmentSDStub (DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment *pSeg)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbSegmentSD(pDrawable, pGC, nseg, pSeg);
else
cfb32SegmentSD(pDrawable, pGC, nseg, pSeg);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbSegmentSD(pDrawable, pGC, nseg, pSeg);
else
cfb32SegmentSD(pDrawable, pGC, nseg, pSeg);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorLineSDStub (DrawablePtr pDrawable, GCPtr pGC,
int mode, int npt, DDXPointPtr ppt)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbLineSD(pDrawable, pGC, mode, npt, ppt);
else
cfb32LineSD(pDrawable, pGC, mode, npt, ppt);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbLineSD(pDrawable, pGC, mode, npt, ppt);
else
cfb32LineSD(pDrawable, pGC, mode, npt, ppt);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorPolyGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph, CharInfoPtr *ppci,
pointer pglyphBase)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
else
cfb32PolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbPolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
else
cfb32PolyGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorImageGlyphBlt8Stub (DrawablePtr pDrawable, GCPtr pGC,
int x, int y, unsigned int nglyph,
CharInfoPtr *ppci, pointer pglyphBase)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
else
cfb32ImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
else
cfb32ImageGlyphBlt8(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorTile32FSCopyStub(DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32Tile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbTile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32Tile32FSCopy(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorTile32FSGeneralStub(DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbTile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32Tile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbTile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32Tile32FSGeneral(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorUnnaturalTileFSStub(DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbUnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32UnnaturalTileFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
Creator8Stipple32FSStub(DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
cfb8Stipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
cfb8Stipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorUnnaturalStippleFSStub(DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbUnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
else
cfb32UnnaturalStippleFS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
Creator8OpaqueStipple32FSStub(DrawablePtr pDrawable, GCPtr pGC,
int nInit, DDXPointPtr pptInit,
int *pwidthInit, int fSorted)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
cfb8OpaqueStipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
cfb8OpaqueStipple32FS(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}
void
CreatorPolyFillRectStub(DrawablePtr pDrawable, GCPtr pGC,
int nrectFill, xRectangle *prectInit)
{
WindowPtr pWin = (WindowPtr) pDrawable;
FFBPtr pFfb = GET_FFB_FROM_SCREEN (pDrawable->pScreen);
ffb_fbcPtr ffb = pFfb->regs;
#ifdef USE_SFB_TRICKS
struct cfb_gcstate cfb_state;
cfbPrivGCPtr devPriv = cfbGetGCPrivate(pGC);
#endif
FFBLOG(("STUB(%s:%d)\n", __FILE__, __LINE__));
#ifndef USE_SFB_TRICKS
FFB_ATTR_SFB_VAR_WIN(pFfb, 0xffffffff, GXcopy, pWin);
FFBWait(pFfb, ffb);
if (pGC->depth == 8)
cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
else
cfb32PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
#else
CFB_STATE_SAVE(&cfb_state, pGC, devPriv);
FFB_ATTR_SFB_VAR_WIN(pFfb, cfb_state.pmask, cfb_state.alu, pWin);
FFBWait(pFfb, ffb);
CFB_STATE_SET_SFB(pGC, devPriv);
if (pGC->depth == 8)
cfbPolyFillRect(pDrawable, pGC, nrectFill, prectInit);
else
cfb32PolyFillRect(pDrawable, pGC, nrectFill, prectInit);
CFB_STATE_RESTORE(&cfb_state, pGC, devPriv);
#endif
}