diff options
author | Robin Cutshaw <robin@intercore.com> | 1999-12-30 03:03:21 +0000 |
---|---|---|
committer | Robin Cutshaw <robin@intercore.com> | 1999-12-30 03:03:21 +0000 |
commit | 30e35cb44b6ea11d0eac8ce0d986517f3224852a (patch) | |
tree | a4bb0182dbcf5e4ce8cd61ed4e257815d9af3957 /hw/kdrive/savage/s3draw.h | |
parent | f13b792a3a8d307a18cd6a41aa5a06622009e42f (diff) |
3516. Jumbo Tiny-X patch with Itsy support (#3527, Keith Packard).xf-3_9_17xf-3_9_16Za
Diffstat (limited to 'hw/kdrive/savage/s3draw.h')
-rw-r--r-- | hw/kdrive/savage/s3draw.h | 107 |
1 files changed, 97 insertions, 10 deletions
diff --git a/hw/kdrive/savage/s3draw.h b/hw/kdrive/savage/s3draw.h index 14dd1688e..80b1b1150 100644 --- a/hw/kdrive/savage/s3draw.h +++ b/hw/kdrive/savage/s3draw.h @@ -22,7 +22,7 @@ * * Author: Keith Packard, SuSE, Inc. */ -/* $XFree86: $ */ +/* $XFree86: xc/programs/Xserver/hw/kdrive/savage/s3draw.h,v 1.1 1999/11/19 13:53:56 hohndel Exp $ */ #ifndef _S3DRAW_H_ #define _S3DRAW_H_ @@ -62,9 +62,69 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); s3CardInfo(pScreenPriv); \ S3Ptr s3 = s3c->s3 +#ifdef S3_SYNC_DEBUG +#define SYNC_DEBUG() fprintf (stderr, "Sync at %s:%d\n", __FILE__,__LINE__) +#else +#define SYNC_DEBUG() +#endif + +#define S3_ASYNC +#ifdef S3_ASYNC +#define CheckSyncS3(s) KdCheckSync(s) +#define MarkSyncS3(s) KdMarkSync(s) +#define RegisterSync(screen) KdScreenInitAsync (screen) +#else +#define CheckSyncS3(s3c) +#define MarkSyncS3(s3c) _s3WaitIdleEmpty(s3c->s3) +#define RegisterSync(screen) +#endif + #define WIDEN(x) ((unsigned long) (x)) #define MERGE(a,b) ((WIDEN(a) << 16) | WIDEN(b)) +/* + * Ok, so the S3 is broken -- it expects bitmaps to come MSB bit order, + * but it's willing to take them in LSB byte order. These macros + * flip bits around without flipping bytes. Instead of using a table + * and burning memory bandwidth, do them in place with the CPU. + */ + +/* The MIPS compiler automatically places these constants in registers */ +#define S3InvertBits32(v) { \ + v = ((v & 0x55555555) << 1) | ((v >> 1) & 0x55555555); \ + v = ((v & 0x33333333) << 2) | ((v >> 2) & 0x33333333); \ + v = ((v & 0x0f0f0f0f) << 4) | ((v >> 4) & 0x0f0f0f0f); \ +} + +#define S3InvertBits16(v) { \ + v = ((v & 0x5555) << 1) | ((v >> 1) & 0x5555); \ + v = ((v & 0x3333) << 2) | ((v >> 2) & 0x3333); \ + v = ((v & 0x0f0f) << 4) | ((v >> 4) & 0x0f0f); \ +} + +#define S3InvertBits8(v) { \ + v = ((v & 0x55) << 1) | ((v >> 1) & 0x55); \ + v = ((v & 0x33) << 2) | ((v >> 2) & 0x33); \ + v = ((v & 0x0f) << 4) | ((v >> 4) & 0x0f); \ +} + +#define S3ByteSwap32(x) ((x) = (((x) >> 24) | \ + (((x) >> 8) & 0xff00) | \ + (((x) << 8) & 0xff0000) | \ + ((x) << 24))) + +#define S3ByteSwap16(x) ((x) = ((x) << 8) | ((x) >> 8)) + +#if BITMAP_BIT_ORDER == LSBFirst +#define S3AdjustBits32(x) S3InvertBits32(x) +#define S3AdjustBits16(x) S3InvertBits16(x) +#else +#define S3AdjustBits32(x) S3ByteSwap32(x) +#define S3AdjustBits16(x) S3ByteSwap16(x) +#endif + +#define _s3WaitSlot(s3) _s3WaitSlots(s3,1) + #define _s3SetFg(s3,_fg) { \ DRAW_DEBUG ((DEBUG_REGISTERS, " fg <- 0x%x", _fg));\ s3->fg = (_fg); \ @@ -87,7 +147,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SetPixelControl(s3,_ctl) { \ DRAW_DEBUG((DEBUG_REGISTERS, " pix_cntl <- 0x%x", PIX_CNTL | (_ctl))); \ - s3->pix_cntl = PIX_CNTL | (_ctl); \ + s3->pix_cntl_mult_misc2 = MERGE (CONTROL_MISC2, PIX_CNTL | (_ctl)); \ } #define _s3SetFgMix(s3,_mix) { \ @@ -141,11 +201,12 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); DRAW_DEBUG((DEBUG_REGISTERS, " cmd <- 0x%x", _cmd)); \ _s3CmdWait(s3); \ s3->cmd_gp_stat = (_cmd); \ - { CARD32 __junk__; __junk__ = s3->cmd_gp_stat; } \ + /* { CARD32 __junk__; __junk__ = s3->cmd_gp_stat; } */ \ } #define _s3SetSolidFill(s3,pix,alu,mask) { \ DRAW_DEBUG((DEBUG_SET,"set fill 0x%x %d 0x%x",pix,alu,mask)); \ + _s3WaitSlots(s3,4); \ _s3SetFg (s3, pix); \ _s3SetWriteMask(s3,mask); \ _s3SetMix (s3, FSS_FRGDCOL | s3alu[alu], BSS_BKGDCOL | MIX_SRC); \ @@ -155,7 +216,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SolidRect(s3,x,y,w,h) {\ DRAW_DEBUG((DEBUG_RENDER,"solid rect %d,%d %dx%d",x,y,w,h)); \ - _s3CmdWait(s3); \ + _s3WaitSlots(s3,3); \ _s3SetCur(s3, x, y); \ _s3SetPcnt (s3, (w)-1, (h)-1); \ _s3SetCmd (s3, CMD_RECT|INC_X|INC_Y|DRAW|WRTDATA); \ @@ -164,15 +225,25 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SolidLine(s3,maj,min,len,cmd) { \ DRAW_DEBUG ((DEBUG_RENDER, "solid line 0x%x 0x%x 0x%x", maj, min, cmd)); \ - _s3CmdWait(s3); \ + _s3WaitSlots(s3,4); \ _s3SetPcnt(s3, (len), 0); \ _s3SetStep(s3, 2*((min) - (maj)), 2*(min)); \ _s3SetErr(s3, 2*(min) - (maj)); \ _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \ } +#define _s3ClipLine(s3,cmd,e1,e2,e,len) {\ + DRAW_DEBUG ((DEBUG_RENDER, "clip line 0x%x 0x%x 0x%x 0x%x 0x%x", cmd,e1,e2,e,len)); \ + _s3WaitSlots(s3, 4); \ + _s3SetPcnt (s3, (len), 0); \ + _s3SetStep (s3, e2, e1); \ + _s3SetErr (s3, e); \ + _s3SetCmd (s3, CMD_LINE | (cmd) | DRAW | WRTDATA); \ +} + #define _s3SetTile(s3,alu,mask) { \ DRAW_DEBUG ((DEBUG_SET,"set tile %d 0x%x", alu, mask)); \ + _s3WaitSlots(s3,3); \ _s3SetWriteMask(s3, mask); \ _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT|s3alu[alu]); \ _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ @@ -185,6 +256,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); */ #define _s3SetStipple(s3,alu,mask,_fg) {\ DRAW_DEBUG ((DEBUG_SET,"set stipple 0x%x %d 0x%x", _fg, alu, mask)); \ + _s3WaitSlots(s3,5); \ _s3SetFg (s3, _fg); \ _s3SetBg (s3, 0); \ _s3SetWriteMask(s3,mask); \ @@ -195,6 +267,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SetOpaqueStipple(s3,alu,mask,_fg,_bg) {\ DRAW_DEBUG ((DEBUG_SET,"set opaque stipple 0x%x 0x%x %d 0x%x", _fg, _bg, alu, mask)); \ + _s3WaitSlots(s3,5); \ _s3SetFg (s3, _fg); \ _s3SetBg (s3, _bg); \ _s3SetWriteMask(s3,mask); \ @@ -205,7 +278,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3PatRect(s3,px,py,x,y,w,h) {\ DRAW_DEBUG ((DEBUG_RENDER, "pat rect %d,%d %dx%d", x,y,w,h)); \ - _s3CmdWait(s3); \ + _s3WaitSlots(s3, 4); \ _s3SetCur (s3, px, py); \ _s3SetStep (s3, x, y); \ _s3SetPcnt (s3, (w)-1, (h)-1); \ @@ -215,6 +288,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SetBlt(s3,alu,mask) { \ DRAW_DEBUG ((DEBUG_SET,"set blt %d 0x%x", alu, mask)); \ + _s3WaitSlots(s3,3); \ _s3SetPixelControl (s3, MIXSEL_FRGDMIX); \ _s3SetMix(s3, FSS_BITBLT | s3alu[alu], BSS_BITBLT | s3alu[alu]); \ _s3SetWriteMask(s3, mask); \ @@ -224,7 +298,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3Blt(s3,_sx,_sy,_dx,_dy,_w,_h,_dir) { \ DRAW_DEBUG ((DEBUG_RENDER, "blt %d,%d -> %d,%d %dx%d 0x%x", \ _sx,_sy,_dx,_dy,_w,_h,_dir)); \ - _s3CmdWait(s3); \ + _s3WaitSlots(s3,4); \ _s3SetCur(s3,_sx,_sy); \ _s3SetStep(s3,_dx,_dy); \ _s3SetPcnt(s3,(_w)-1,(_h)-1); \ @@ -235,6 +309,8 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SetOpaquePlaneBlt(s3,alu,mask,_fg,_bg) {\ DRAW_DEBUG ((DEBUG_SET,"set opaque plane blt 0x%x 0x%x %d 0x%x", \ _fg, _bg, alu, mask)); \ + /* _s3WaitSlots(s3, 5); */ \ + _s3WaitIdleEmpty (s3); \ _s3SetFg(s3,_fg); \ _s3SetBg(s3,_bg); \ _s3SetWriteMask(s3,mask); \ @@ -246,6 +322,8 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SetTransparentPlaneBlt(s3,alu,mask,_fg) {\ DRAW_DEBUG ((DEBUG_SET,"set transparent plane blt 0x%x %d 0x%x", \ _fg, alu, mask)); \ + /*_s3WaitSlots(s3, 4); */ \ + _s3WaitIdleEmpty (s3); \ _s3SetFg(s3,_fg); \ _s3SetWriteMask(s3,mask); \ _s3SetMix(s3,FSS_FRGDCOL|s3alu[alu], BSS_BKGDCOL|MIX_DST); \ @@ -256,7 +334,8 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); /* Across the plane blt */ #define _s3PlaneBlt(s3,x,y,w,h) {\ DRAW_DEBUG ((DEBUG_RENDER, "plane blt %d,%d %dx%d", x,y,w,h)); \ - _s3CmdWait(s3); \ + _s3WaitSlots(s3, 4); \ + _s3SetPixelControl(s3,MIXSEL_EXPPC); \ _s3SetCur(s3, x, y); \ _s3SetPcnt (s3, (w)-1, (h)-1); \ _s3SetCmd (s3, \ @@ -274,7 +353,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3SetClip(s3,pbox) {\ DRAW_DEBUG ((DEBUG_SET, "set clip %dx%d -> %dx%d ", \ pbox->x1, pbox->y1, pbox->x2, pbox->y2)); \ - _s3WaitEmpty(s3); \ + _s3WaitSlots(s3, 2); \ _s3SetScissorsTl(s3,(pbox)->x1, (pbox)->y1); \ _s3SetScissorsBr(s3,(pbox)->x2 - 1, (pbox)->y2 - 1); \ DRAW_DEBUG((DEBUG_SET," done")); \ @@ -282,7 +361,7 @@ void _s3LoadPattern (ScreenPtr pScreen, s3PatternPtr pPattern); #define _s3ResetClip(s3,pScreen) { \ DRAW_DEBUG ((DEBUG_SET, "reset clip")); \ - _s3WaitEmpty(s3); \ + _s3WaitSlots(s3, 2); \ _s3SetScissorsTl(s3,0,0); \ _s3SetScissorsBr(s3,pScreen->width - 1, pScreen->height - 1); \ DRAW_DEBUG((DEBUG_SET," done")); \ @@ -298,6 +377,11 @@ s3CopyPlane(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int dstx, int dsty, unsigned long bitPlane); void +s3PushPixels (GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, + int w, int h, int x, int y); + +void s3FillBoxSolid (DrawablePtr pDrawable, int nBox, BoxPtr pBox, unsigned long pixel, int alu, unsigned long planemask); @@ -369,4 +453,7 @@ s3CheckGCFill (GCPtr pGC); void s3MoveGCFill (GCPtr pGC); +void +s3SyncProc (DrawablePtr pDrawable); + #endif |